defaultroute revision 117032
1#!/bin/sh 2# 3# Configure routing and miscellaneous network tunables 4# 5# $FreeBSD: head/etc/rc.d/routing 117032 2003-06-29 17:59:09Z mtm $ 6# 7 8# PROVIDE: routing 9# REQUIRE: netif ppp-user 10# KEYWORD: FreeBSD 11 12. /etc/rc.subr 13 14name="routing" 15start_cmd="routing_start" 16stop_cmd="routing_stop" 17extra_commands="options static" 18static_cmd="static_start" 19options_cmd="options_start" 20 21routing_start() 22{ 23 static_start 24 options_start 25} 26 27routing_stop() 28{ 29 route -n flush 30} 31 32static_start() 33{ 34 case ${defaultrouter} in 35 [Nn][Oo] | '') 36 ;; 37 *) 38 static_routes="default ${static_routes}" 39 route_default="default ${defaultrouter}" 40 ;; 41 esac 42 43 # Setup static routes. This should be done before router discovery. 44 # 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 50 fi 51} 52 53options_start() 54{ 55 echo -n 'Additional routing options:' 56 case ${tcp_extensions} in 57 [Yy][Ee][Ss] | '') 58 ;; 59 *) 60 echo -n ' tcp extensions=NO' 61 sysctl net.inet.tcp.rfc1323=0 >/dev/null 62 ;; 63 esac 64 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 69 ;; 70 esac 71 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 76 ;; 77 esac 78 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 83 ;; 84 esac 85 86 case ${gateway_enable} in 87 [Yy][Ee][Ss]) 88 echo -n ' IP gateway=YES' 89 sysctl net.inet.ip.forwarding=1 >/dev/null 90 ;; 91 esac 92 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 97 ;; 98 esac 99 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 104 ;; 105 esac 106 107 case ${tcp_keepalive} in 108 [Nn][Oo]) 109 echo -n ' TCP keepalive=NO' 110 sysctl net.inet.tcp.always_keepalive=0 >/dev/null 111 ;; 112 esac 113 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 118 ;; 119 esac 120 121 case ${ipxgateway_enable} in 122 [Yy][Ee][Ss]) 123 echo -n ' IPX gateway=YES' 124 sysctl net.ipx.ipx.ipxforwarding=1 >/dev/null 125 ;; 126 esac 127 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 132 ;; 133 esac 134 135 case ${ip_portrange_first} in 136 [Nn][Oo] | '') 137 ;; 138 *) 139 echo -n " ip_portrange_first=$ip_portrange_first" 140 sysctl net.inet.ip.portrange.first=$ip_portrange_first >/dev/null 141 ;; 142 esac 143 144 case ${ip_portrange_last} in 145 [Nn][Oo] | '') 146 ;; 147 *) 148 echo -n " ip_portrange_last=$ip_portrange_last" 149 sysctl net.inet.ip.portrange.last=$ip_portrange_last >/dev/null 150 ;; 151 esac 152 153 echo '.' 154} 155 156load_rc_config $name 157run_rc_command "$1" 158