routing revision 179940
1100280Sgordon#!/bin/sh 225184Sjkh# 3100280Sgordon# Configure routing and miscellaneous network tunables 466830Sobrien# 550472Speter# $FreeBSD: head/etc/rc.d/routing 179940 2008-06-23 04:00:45Z mtm $ 666830Sobrien# 725184Sjkh 8117019Smtm# PROVIDE: routing 9179566Sbrooks# REQUIRE: netif ppp 10136224Smtm# KEYWORD: nojail 1125184Sjkh 12100280Sgordon. /etc/rc.subr 13179079Sbrooks. /etc/network.subr 1425184Sjkh 15117019Smtmname="routing" 16117019Smtmstart_cmd="routing_start" 17117019Smtmstop_cmd="routing_stop" 18117019Smtmextra_commands="options static" 19117019Smtmstatic_cmd="static_start" 20117019Smtmoptions_cmd="options_start" 2185831Sdes 22117019Smtmrouting_start() 23100280Sgordon{ 24117019Smtm static_start 25117019Smtm options_start 26117019Smtm} 27117019Smtm 28117019Smtmrouting_stop() 29117019Smtm{ 30117019Smtm route -n flush 31117019Smtm} 32117019Smtm 33117019Smtmstatic_start() 34117019Smtm{ 3551231Ssheldonh case ${defaultrouter} in 3651231Ssheldonh [Nn][Oo] | '') 3751231Ssheldonh ;; 3851231Ssheldonh *) 3951231Ssheldonh static_routes="default ${static_routes}" 4051231Ssheldonh route_default="default ${defaultrouter}" 4151231Ssheldonh ;; 4251231Ssheldonh esac 4340006Sphk 44100280Sgordon # Setup static routes. This should be done before router discovery. 4551231Ssheldonh # 4651231Ssheldonh if [ -n "${static_routes}" ]; then 4751231Ssheldonh for i in ${static_routes}; do 4851231Ssheldonh eval route_args=\$route_${i} 49117032Smtm route add ${route_args} 5051231Ssheldonh done 5151231Ssheldonh fi 52118908Sharti # Now ATM static routes 53118908Sharti # 54118908Sharti if [ -n "${natm_static_routes}" ]; then 55118908Sharti for i in ${natm_static_routes}; do 56118908Sharti eval route_args=\$route_${i} 57118908Sharti atmconfig natm add ${route_args} 58118908Sharti done 59118908Sharti fi 60117019Smtm} 6129300Sdanny 62179940Smtm_ropts_initdone= 63179940Smtmropts_init() 64179940Smtm{ 65179940Smtm if [ -z "${_ropts_initdone}" ]; then 66179940Smtm echo -n 'Additional routing options:' 67179940Smtm _ropts_initdone=yes 68179940Smtm fi 69179940Smtm} 70179940Smtm 71117019Smtmoptions_start() 72117019Smtm{ 7351231Ssheldonh case ${icmp_bmcastecho} in 7451231Ssheldonh [Yy][Ee][Ss]) 75179940Smtm ropts_init 7651231Ssheldonh echo -n ' broadcast ping responses=YES' 7787646Sru sysctl net.inet.icmp.bmcastecho=1 >/dev/null 7851231Ssheldonh ;; 7951231Ssheldonh esac 8045096Simp 8151231Ssheldonh case ${icmp_drop_redirect} in 8251231Ssheldonh [Yy][Ee][Ss]) 83179940Smtm ropts_init 8451231Ssheldonh echo -n ' ignore ICMP redirect=YES' 8587646Sru sysctl net.inet.icmp.drop_redirect=1 >/dev/null 8651231Ssheldonh ;; 8751231Ssheldonh esac 8839267Sjkoshy 8951231Ssheldonh case ${icmp_log_redirect} in 9051231Ssheldonh [Yy][Ee][Ss]) 91179940Smtm ropts_init 9251231Ssheldonh echo -n ' log ICMP redirect=YES' 9387646Sru sysctl net.inet.icmp.log_redirect=1 >/dev/null 9451231Ssheldonh ;; 9551231Ssheldonh esac 9633439Sguido 9751231Ssheldonh case ${gateway_enable} in 9851231Ssheldonh [Yy][Ee][Ss]) 99179940Smtm ropts_init 10051231Ssheldonh echo -n ' IP gateway=YES' 10187646Sru sysctl net.inet.ip.forwarding=1 >/dev/null 10251231Ssheldonh ;; 10351231Ssheldonh esac 10433439Sguido 10551231Ssheldonh case ${forward_sourceroute} in 10651231Ssheldonh [Yy][Ee][Ss]) 107179940Smtm ropts_init 10851231Ssheldonh echo -n ' do source routing=YES' 10987646Sru sysctl net.inet.ip.sourceroute=1 >/dev/null 11051231Ssheldonh ;; 11151231Ssheldonh esac 11247752Sphk 11351231Ssheldonh case ${accept_sourceroute} in 11451231Ssheldonh [Yy][Ee][Ss]) 115179940Smtm ropts_init 11651231Ssheldonh echo -n ' accept source routing=YES' 11787646Sru sysctl net.inet.ip.accept_sourceroute=1 >/dev/null 11851231Ssheldonh ;; 11951231Ssheldonh esac 12051209Sdes 12151231Ssheldonh case ${ipxgateway_enable} in 12251231Ssheldonh [Yy][Ee][Ss]) 123179940Smtm ropts_init 12451231Ssheldonh echo -n ' IPX gateway=YES' 12587646Sru sysctl net.ipx.ipx.ipxforwarding=1 >/dev/null 12651231Ssheldonh ;; 12751231Ssheldonh esac 12851231Ssheldonh 12951231Ssheldonh case ${arpproxy_all} in 13051231Ssheldonh [Yy][Ee][Ss]) 131179940Smtm ropts_init 13251231Ssheldonh echo -n ' ARP proxyall=YES' 13387646Sru sysctl net.link.ether.inet.proxyall=1 >/dev/null 13451231Ssheldonh ;; 13551231Ssheldonh esac 13661961Sdillon 137179940Smtm [ -n "${_ropts_initdone}" ] && echo '.' 13825184Sjkh} 13925184Sjkh 140100280Sgordonload_rc_config $name 141100280Sgordonrun_rc_command "$1" 142