Sync 'make distribution' with an upgraded system, file-wise.
[dragonfly.git] / etc / rc.d / routing
blob79de961e31dc894762cd6be47291aebe0d0927ac
1 #!/bin/sh
3 # Configure routing and miscellaneous network tunables
5 # $FreeBSD: src/etc/rc.d/routing,v 1.138 2003/06/29 17:59:09 mtm Exp $
6 # $DragonFly: src/etc/rc.d/routing,v 1.3 2005/11/19 21:47:32 swildner Exp $
9 # PROVIDE: routing
10 # REQUIRE: netif ppp-user
12 . /etc/rc.subr
14 name="routing"
15 start_cmd="routing_start"
16 stop_cmd="routing_stop"
17 extra_commands="options static change"
18 static_cmd="static_start"
19 change_cmd="change_start"
20 options_cmd="options_start"
22 routing_start()
24 static_start
25 change_start
26 options_start
29 routing_stop()
31 route -n flush
34 static_start()
36 case ${defaultrouter} in
37 [Nn][Oo] | '')
40 static_routes="default ${static_routes}"
41 route_default="default ${defaultrouter}"
43 esac
45 # Setup static routes. This should be done before router discovery.
47 if [ -n "${static_routes}" ]; then
48 for i in ${static_routes}; do
49 eval route_args=\$route_${i}
50 route add ${route_args}
51 done
55 change_start()
57 # Change routes. This should be done before router discovery.
59 if [ -n "${change_routes}" ]; then
60 for i in ${change_routes}; do
61 eval route_args=\$change_route_${i}
62 route change ${route_args}
63 done
67 options_start()
69 echo -n 'Additional routing options:'
70 case ${tcp_extensions} in
71 [Yy][Ee][Ss] | '')
74 echo -n ' tcp extensions=NO'
75 sysctl net.inet.tcp.rfc1323=0 >/dev/null
77 esac
79 case ${icmp_bmcastecho} in
80 [Yy][Ee][Ss])
81 echo -n ' broadcast ping responses=YES'
82 sysctl net.inet.icmp.bmcastecho=1 >/dev/null
84 esac
86 case ${icmp_drop_redirect} in
87 [Yy][Ee][Ss])
88 echo -n ' ignore ICMP redirect=YES'
89 sysctl net.inet.icmp.drop_redirect=1 >/dev/null
91 esac
93 case ${icmp_log_redirect} in
94 [Yy][Ee][Ss])
95 echo -n ' log ICMP redirect=YES'
96 sysctl net.inet.icmp.log_redirect=1 >/dev/null
98 esac
100 case ${gateway_enable} in
101 [Yy][Ee][Ss])
102 echo -n ' IP gateway=YES'
103 sysctl net.inet.ip.forwarding=1 >/dev/null
105 esac
107 case ${forward_sourceroute} in
108 [Yy][Ee][Ss])
109 echo -n ' do source routing=YES'
110 sysctl net.inet.ip.sourceroute=1 >/dev/null
112 esac
114 case ${accept_sourceroute} in
115 [Yy][Ee][Ss])
116 echo -n ' accept source routing=YES'
117 sysctl net.inet.ip.accept_sourceroute=1 >/dev/null
119 esac
121 case ${tcp_keepalive} in
122 [Nn][Oo])
123 echo -n ' TCP keepalive=NO'
124 sysctl net.inet.tcp.always_keepalive=0 >/dev/null
126 esac
128 case ${tcp_drop_synfin} in
129 [Yy][Ee][Ss])
130 echo -n ' drop SYN+FIN packets=YES'
131 sysctl net.inet.tcp.drop_synfin=1 >/dev/null
133 esac
135 case ${ipxgateway_enable} in
136 [Yy][Ee][Ss])
137 echo -n ' IPX gateway=YES'
138 sysctl net.ipx.ipx.ipxforwarding=1 >/dev/null
140 esac
142 case ${arpproxy_all} in
143 [Yy][Ee][Ss])
144 echo -n ' ARP proxyall=YES'
145 sysctl net.link.ether.inet.proxyall=1 >/dev/null
147 esac
149 case ${ip_portrange_first} in
150 [Nn][Oo] | '')
153 echo -n " ip_portrange_first=$ip_portrange_first"
154 sysctl net.inet.ip.portrange.first=$ip_portrange_first >/dev/null
156 esac
158 case ${ip_portrange_last} in
159 [Nn][Oo] | '')
162 echo -n " ip_portrange_last=$ip_portrange_last"
163 sysctl net.inet.ip.portrange.last=$ip_portrange_last >/dev/null
165 esac
167 echo '.'
170 load_rc_config $name
171 run_rc_command "$1"