MFC r1.6 r1.30 r1.28 (HEAD):
[dragonfly.git] / etc / rc.d / routing
blob15dcbcfba7638e3358df71a0204ec043100613cc
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"
18 static_cmd="static_start"
19 options_cmd="options_start"
21 routing_start()
23 static_start
24 options_start
27 routing_stop()
29 route -n flush
32 static_start()
34 case ${defaultrouter} in
35 [Nn][Oo] | '')
38 static_routes="default ${static_routes}"
39 route_default="default ${defaultrouter}"
41 esac
43 # Setup static routes. This should be done before router discovery.
45 if [ -n "${static_routes}" ]; then
46 for i in ${static_routes}; do
47 eval route_args=\$route_${i}
48 route add ${route_args}
49 done
53 options_start()
55 echo -n 'Additional routing options:'
56 case ${tcp_extensions} in
57 [Yy][Ee][Ss] | '')
60 echo -n ' tcp extensions=NO'
61 sysctl net.inet.tcp.rfc1323=0 >/dev/null
63 esac
65 case ${icmp_bmcastecho} in
66 [Yy][Ee][Ss])
67 echo -n ' broadcast ping responses=YES'
68 sysctl net.inet.icmp.bmcastecho=1 >/dev/null
70 esac
72 case ${icmp_drop_redirect} in
73 [Yy][Ee][Ss])
74 echo -n ' ignore ICMP redirect=YES'
75 sysctl net.inet.icmp.drop_redirect=1 >/dev/null
77 esac
79 case ${icmp_log_redirect} in
80 [Yy][Ee][Ss])
81 echo -n ' log ICMP redirect=YES'
82 sysctl net.inet.icmp.log_redirect=1 >/dev/null
84 esac
86 case ${gateway_enable} in
87 [Yy][Ee][Ss])
88 echo -n ' IP gateway=YES'
89 sysctl net.inet.ip.forwarding=1 >/dev/null
91 esac
93 case ${forward_sourceroute} in
94 [Yy][Ee][Ss])
95 echo -n ' do source routing=YES'
96 sysctl net.inet.ip.sourceroute=1 >/dev/null
98 esac
100 case ${accept_sourceroute} in
101 [Yy][Ee][Ss])
102 echo -n ' accept source routing=YES'
103 sysctl net.inet.ip.accept_sourceroute=1 >/dev/null
105 esac
107 case ${tcp_keepalive} in
108 [Nn][Oo])
109 echo -n ' TCP keepalive=NO'
110 sysctl net.inet.tcp.always_keepalive=0 >/dev/null
112 esac
114 case ${tcp_drop_synfin} in
115 [Yy][Ee][Ss])
116 echo -n ' drop SYN+FIN packets=YES'
117 sysctl net.inet.tcp.drop_synfin=1 >/dev/null
119 esac
121 case ${ipxgateway_enable} in
122 [Yy][Ee][Ss])
123 echo -n ' IPX gateway=YES'
124 sysctl net.ipx.ipx.ipxforwarding=1 >/dev/null
126 esac
128 case ${arpproxy_all} in
129 [Yy][Ee][Ss])
130 echo -n ' ARP proxyall=YES'
131 sysctl net.link.ether.inet.proxyall=1 >/dev/null
133 esac
135 case ${ip_portrange_first} in
136 [Nn][Oo] | '')
139 echo -n " ip_portrange_first=$ip_portrange_first"
140 sysctl net.inet.ip.portrange.first=$ip_portrange_first >/dev/null
142 esac
144 case ${ip_portrange_last} in
145 [Nn][Oo] | '')
148 echo -n " ip_portrange_last=$ip_portrange_last"
149 sysctl net.inet.ip.portrange.last=$ip_portrange_last >/dev/null
151 esac
153 echo '.'
156 load_rc_config $name
157 run_rc_command "$1"