3 # Configure routing and miscellaneous network tunables
9 # REQUIRE: faith netif ppp stf
16 start_cmd="routing_start doall"
17 stop_cmd="routing_stop"
18 extra_commands="options static"
19 static_cmd="routing_start static"
20 options_cmd="routing_start options"
25 ""|inet|inet6|ipx|atm)
28 err 1 "Unsupported address family: $_af."
46 for _a in inet inet6 ipx atm; do
47 afexists $_a && setroutes $_cmd $_a
62 eval static_${_af} delete
63 eval routing_stop_${_af}
66 for _a in inet inet6 ipx atm; do
67 afexists $_a || continue
68 eval static_${_a} delete
69 eval routing_stop_${_a}
100 route -n flush -inet6
101 for i in ${ipv6_network_interfaces}; do
102 ifconfig $i inet6 -defaultif
121 case ${defaultrouter} in
125 static_routes="default ${static_routes}"
126 route_default="default ${defaultrouter}"
130 if [ -n "${static_routes}" ]; then
131 for i in ${static_routes}; do
132 route_args=`get_if_var $i route_IF`
133 route ${_action} ${route_args}
140 local _action fibmod fibs
143 # get the number of FIBs supported.
144 fibs=$((`${SYSCTL_N} net.fibs` - 1))
145 if [ "$fibs" -gt 0 ]; then
146 fibmod="-fib 0-$fibs"
151 # disallow "internal" addresses to appear on the wire
152 route ${_action} -inet6 ::ffff:0.0.0.0 -prefixlen 96 ::1 -reject ${fibmod}
153 route ${_action} -inet6 ::0.0.0.0 -prefixlen 96 ::1 -reject ${fibmod}
155 case ${ipv6_defaultrouter} in
159 ipv6_static_routes="default ${ipv6_static_routes}"
160 ipv6_route_default="default ${ipv6_defaultrouter}"
164 if [ -n "${ipv6_static_routes}" ]; then
165 for i in ${ipv6_static_routes}; do
166 ipv6_route_args=`get_if_var $i ipv6_route_IF`
167 route ${_action} -inet6 ${ipv6_route_args}
171 # Fixup $ipv6_network_interfaces
172 case ${ipv6_network_interfaces} in
174 ipv6_network_interfaces=''
178 if checkyesno ipv6_gateway_enable; then
179 for i in ${ipv6_network_interfaces}; do
181 laddr=`network6_getladdr $i exclude_tentative`
186 ipv6_working_interfaces="$i \
187 ${ipv6_working_interfaces}"
191 ipv6_network_interfaces=${ipv6_working_interfaces}
194 # Install the "default interface" to kernel, which will be used
195 # as the default route when there's no router.
196 case "${ipv6_default_interface}" in
197 [Nn][Oo] | [Nn][Oo][Nn][Ee])
198 ipv6_default_interface=""
200 [Aa][Uu][Tt][Oo] | "")
201 for i in ${ipv6_network_interfaces}; do
207 laddr=`network6_getladdr $i exclude_tentative`
212 ipv6_default_interface=$i
220 # Disallow link-local unicast packets without outgoing scope
221 # identifiers. However, if you set "ipv6_default_interface",
222 # for the host case, you will allow to omit the identifiers.
223 # Under this configuration, the packets will go to the default
225 route ${_action} -inet6 fe80:: -prefixlen 10 ::1 -reject ${fibmod}
226 route ${_action} -inet6 ff02:: -prefixlen 16 ::1 -reject ${fibmod}
228 case ${ipv6_default_interface} in
232 # Disable installing the default interface when we act
233 # as router to avoid conflict between the default
234 # router list and the manual configured default route.
235 if ! checkyesno ipv6_gateway_enable; then
236 ifconfig ${ipv6_default_interface} inet6 defaultif
237 sysctl net.inet6.ip6.use_defaultzone=1
245 local _action i route_args
248 if [ -n "${natm_static_routes}" ]; then
249 for i in ${natm_static_routes}; do
250 route_args=`get_if_var $i route_IF`
251 atmconfig natm ${_action} ${route_args}
262 if [ -z "${_ropts_initdone}" ]; then
263 echo -n "Additional $1 routing options:"
271 if checkyesno icmp_bmcastecho; then
273 echo -n ' broadcast ping responses=YES'
274 ${SYSCTL} net.inet.icmp.bmcastecho=1 > /dev/null
276 ${SYSCTL} net.inet.icmp.bmcastecho=0 > /dev/null
279 if checkyesno icmp_drop_redirect; then
281 echo -n ' ignore ICMP redirect=YES'
282 ${SYSCTL} net.inet.icmp.drop_redirect=1 > /dev/null
284 ${SYSCTL} net.inet.icmp.drop_redirect=0 > /dev/null
287 if checkyesno icmp_log_redirect; then
289 echo -n ' log ICMP redirect=YES'
290 ${SYSCTL} net.inet.icmp.log_redirect=1 > /dev/null
292 ${SYSCTL} net.inet.icmp.log_redirect=0 > /dev/null
295 if checkyesno gateway_enable; then
297 echo -n ' gateway=YES'
298 ${SYSCTL} net.inet.ip.forwarding=1 > /dev/null
300 ${SYSCTL} net.inet.ip.forwarding=0 > /dev/null
303 if checkyesno forward_sourceroute; then
305 echo -n ' do source routing=YES'
306 ${SYSCTL} net.inet.ip.sourceroute=1 > /dev/null
308 ${SYSCTL} net.inet.ip.sourceroute=0 > /dev/null
311 if checkyesno accept_sourceroute; then
313 echo -n ' accept source routing=YES'
314 ${SYSCTL} net.inet.ip.accept_sourceroute=1 > /dev/null
316 ${SYSCTL} net.inet.ip.accept_sourceroute=0 > /dev/null
319 if checkyesno arpproxy_all; then
321 echo -n ' ARP proxyall=YES'
322 ${SYSCTL} net.link.ether.inet.proxyall=1 > /dev/null
324 ${SYSCTL} net.link.ether.inet.proxyall=0 > /dev/null
327 [ -n "${_ropts_initdone}" ] && echo '.'
334 if checkyesno ipv6_gateway_enable; then
336 echo -n ' gateway=YES'
337 ${SYSCTL} net.inet6.ip6.forwarding=1 > /dev/null
339 ${SYSCTL} net.inet6.ip6.forwarding=0 > /dev/null
342 [ -n "${_ropts_initdone}" ] && echo '.'
349 [ -n "${_ropts_initdone}" ] && echo '.'
356 if checkyesno ipxgateway_enable; then
358 echo -n ' gateway=YES'
359 ${SYSCTL} net.ipx.ipx.ipxforwarding=1 > /dev/null
361 ${SYSCTL} net.ipx.ipx.ipxforwarding=0 > /dev/null
364 [ -n "${_ropts_initdone}" ] && echo '.'