defaultroute revision 117019
1100280Sgordon#!/bin/sh 225184Sjkh# 3100280Sgordon# Configure routing and miscellaneous network tunables 466830Sobrien# 550472Speter# $FreeBSD: head/etc/rc.d/routing 117019 2003-06-29 05:09:48Z mtm $ 666830Sobrien# 725184Sjkh 8117019Smtm# PROVIDE: routing 9113676Smtm# REQUIRE: netif ppp-user 10100280Sgordon# KEYWORD: FreeBSD 1125184Sjkh 12100280Sgordon. /etc/rc.subr 1325184Sjkh 14117019Smtmname="routing" 15117019Smtmstart_cmd="routing_start" 16117019Smtmstop_cmd="routing_stop" 17117019Smtmextra_commands="options static" 18117019Smtmstatic_cmd="static_start" 19117019Smtmoptions_cmd="options_start" 2085831Sdes 21117019Smtmrouting_start() 22100280Sgordon{ 23117019Smtm static_start 24117019Smtm options_start 25117019Smtm} 26117019Smtm 27117019Smtmrouting_stop() 28117019Smtm{ 29117019Smtm route -n flush 30117019Smtm} 31117019Smtm 32117019Smtmstatic_start() 33117019Smtm{ 3451231Ssheldonh case ${defaultrouter} in 3551231Ssheldonh [Nn][Oo] | '') 3651231Ssheldonh ;; 3751231Ssheldonh *) 3851231Ssheldonh static_routes="default ${static_routes}" 3951231Ssheldonh route_default="default ${defaultrouter}" 4051231Ssheldonh ;; 4151231Ssheldonh esac 4240006Sphk 43100280Sgordon # Setup static routes. This should be done before router discovery. 4451231Ssheldonh # 4551231Ssheldonh if [ -n "${static_routes}" ]; then 4651231Ssheldonh for i in ${static_routes}; do 4751231Ssheldonh eval route_args=\$route_${i} 48117019Smtm echo route add ${route_args} 4951231Ssheldonh done 5051231Ssheldonh fi 51117019Smtm} 5229300Sdanny 53117019Smtmoptions_start() 54117019Smtm{ 5551231Ssheldonh echo -n 'Additional routing options:' 5651231Ssheldonh case ${tcp_extensions} in 5751231Ssheldonh [Yy][Ee][Ss] | '') 5851231Ssheldonh ;; 5951231Ssheldonh *) 6051231Ssheldonh echo -n ' tcp extensions=NO' 6187646Sru sysctl net.inet.tcp.rfc1323=0 >/dev/null 6251231Ssheldonh ;; 6351231Ssheldonh esac 6425184Sjkh 6551231Ssheldonh case ${icmp_bmcastecho} in 6651231Ssheldonh [Yy][Ee][Ss]) 6751231Ssheldonh echo -n ' broadcast ping responses=YES' 6887646Sru sysctl net.inet.icmp.bmcastecho=1 >/dev/null 6951231Ssheldonh ;; 7051231Ssheldonh esac 7145096Simp 7251231Ssheldonh case ${icmp_drop_redirect} in 7351231Ssheldonh [Yy][Ee][Ss]) 7451231Ssheldonh echo -n ' ignore ICMP redirect=YES' 7587646Sru sysctl net.inet.icmp.drop_redirect=1 >/dev/null 7651231Ssheldonh ;; 7751231Ssheldonh esac 7839267Sjkoshy 7951231Ssheldonh case ${icmp_log_redirect} in 8051231Ssheldonh [Yy][Ee][Ss]) 8151231Ssheldonh echo -n ' log ICMP redirect=YES' 8287646Sru sysctl net.inet.icmp.log_redirect=1 >/dev/null 8351231Ssheldonh ;; 8451231Ssheldonh esac 8533439Sguido 8651231Ssheldonh case ${gateway_enable} in 8751231Ssheldonh [Yy][Ee][Ss]) 8851231Ssheldonh echo -n ' IP gateway=YES' 8987646Sru sysctl net.inet.ip.forwarding=1 >/dev/null 9051231Ssheldonh ;; 9151231Ssheldonh esac 9233439Sguido 9351231Ssheldonh case ${forward_sourceroute} in 9451231Ssheldonh [Yy][Ee][Ss]) 9551231Ssheldonh echo -n ' do source routing=YES' 9687646Sru sysctl net.inet.ip.sourceroute=1 >/dev/null 9751231Ssheldonh ;; 9851231Ssheldonh esac 9947752Sphk 10051231Ssheldonh case ${accept_sourceroute} in 10151231Ssheldonh [Yy][Ee][Ss]) 10251231Ssheldonh echo -n ' accept source routing=YES' 10387646Sru sysctl net.inet.ip.accept_sourceroute=1 >/dev/null 10451231Ssheldonh ;; 10551231Ssheldonh esac 10651209Sdes 10751231Ssheldonh case ${tcp_keepalive} in 10887500Srwatson [Nn][Oo]) 10987500Srwatson echo -n ' TCP keepalive=NO' 11087646Sru sysctl net.inet.tcp.always_keepalive=0 >/dev/null 11151231Ssheldonh ;; 11251231Ssheldonh esac 11351209Sdes 11451231Ssheldonh case ${tcp_drop_synfin} in 11551231Ssheldonh [Yy][Ee][Ss]) 11651231Ssheldonh echo -n ' drop SYN+FIN packets=YES' 11787646Sru sysctl net.inet.tcp.drop_synfin=1 >/dev/null 11851231Ssheldonh ;; 11951231Ssheldonh esac 12036174Sjkh 12151231Ssheldonh case ${ipxgateway_enable} in 12251231Ssheldonh [Yy][Ee][Ss]) 12351231Ssheldonh echo -n ' IPX gateway=YES' 12487646Sru sysctl net.ipx.ipx.ipxforwarding=1 >/dev/null 12551231Ssheldonh ;; 12651231Ssheldonh esac 12751231Ssheldonh 12851231Ssheldonh case ${arpproxy_all} in 12951231Ssheldonh [Yy][Ee][Ss]) 13051231Ssheldonh echo -n ' ARP proxyall=YES' 13187646Sru sysctl net.link.ether.inet.proxyall=1 >/dev/null 13251231Ssheldonh ;; 13351231Ssheldonh esac 13461961Sdillon 13561961Sdillon case ${ip_portrange_first} in 13661961Sdillon [Nn][Oo] | '') 13761961Sdillon ;; 13861961Sdillon *) 13967012Sru echo -n " ip_portrange_first=$ip_portrange_first" 14087646Sru sysctl net.inet.ip.portrange.first=$ip_portrange_first >/dev/null 14161961Sdillon ;; 14261961Sdillon esac 14361961Sdillon 14461961Sdillon case ${ip_portrange_last} in 14561961Sdillon [Nn][Oo] | '') 14664731Sjhb ;; 14761961Sdillon *) 14867012Sru echo -n " ip_portrange_last=$ip_portrange_last" 14987646Sru sysctl net.inet.ip.portrange.last=$ip_portrange_last >/dev/null 15061961Sdillon ;; 15161961Sdillon esac 15261961Sdillon 15351231Ssheldonh echo '.' 15425184Sjkh} 15525184Sjkh 156100280Sgordonload_rc_config $name 157100280Sgordonrun_rc_command "$1" 158