routing revision 100280
1100280Sgordon#!/bin/sh
225184Sjkh#
3100280Sgordon# Configure routing and miscellaneous network tunables
466830Sobrien#
550472Speter# $FreeBSD: head/etc/rc.d/routing 100280 2002-07-18 05:00:17Z gordon $
666830Sobrien#
725184Sjkh
8100280Sgordon# PROVIDE: network2
9100280Sgordon# REQUIRE: network1 ppp-user
10100280Sgordon# KEYWORD: FreeBSD
1125184Sjkh
12100280Sgordon. /etc/rc.subr
1325184Sjkh
14100280Sgordonname="network2"
15100280Sgordonstart_cmd="network2_start"
16100280Sgordonstop_cmd=":"
1785831Sdes
18100280Sgordonnetwork2_start()
19100280Sgordon{
2051231Ssheldonh	case ${defaultrouter} in
2151231Ssheldonh	[Nn][Oo] | '')
2251231Ssheldonh		;;
2351231Ssheldonh	*)
2451231Ssheldonh		static_routes="default ${static_routes}"
2551231Ssheldonh		route_default="default ${defaultrouter}"
2651231Ssheldonh		;;
2751231Ssheldonh	esac
2840006Sphk
29100280Sgordon	# Setup static routes. This should be done before router discovery.
3051231Ssheldonh	#
3151231Ssheldonh	if [ -n "${static_routes}" ]; then
3251231Ssheldonh		for i in ${static_routes}; do
3351231Ssheldonh			eval route_args=\$route_${i}
3451231Ssheldonh			route add ${route_args}
3551231Ssheldonh		done
3651231Ssheldonh	fi
3729300Sdanny
3851231Ssheldonh	echo -n 'Additional routing options:'
3951231Ssheldonh	case ${tcp_extensions} in
4051231Ssheldonh	[Yy][Ee][Ss] | '')
4151231Ssheldonh		;;
4251231Ssheldonh	*)
4351231Ssheldonh		echo -n ' tcp extensions=NO'
4487646Sru		sysctl net.inet.tcp.rfc1323=0 >/dev/null
4551231Ssheldonh		;;
4651231Ssheldonh	esac
4725184Sjkh
4851231Ssheldonh	case ${icmp_bmcastecho} in
4951231Ssheldonh	[Yy][Ee][Ss])
5051231Ssheldonh		echo -n ' broadcast ping responses=YES'
5187646Sru		sysctl net.inet.icmp.bmcastecho=1 >/dev/null
5251231Ssheldonh		;;
5351231Ssheldonh	esac
5445096Simp
5551231Ssheldonh	case ${icmp_drop_redirect} in
5651231Ssheldonh	[Yy][Ee][Ss])
5751231Ssheldonh		echo -n ' ignore ICMP redirect=YES'
5887646Sru		sysctl net.inet.icmp.drop_redirect=1 >/dev/null
5951231Ssheldonh		;;
6051231Ssheldonh	esac
6139267Sjkoshy
6251231Ssheldonh	case ${icmp_log_redirect} in
6351231Ssheldonh	[Yy][Ee][Ss])
6451231Ssheldonh		echo -n ' log ICMP redirect=YES'
6587646Sru		sysctl net.inet.icmp.log_redirect=1 >/dev/null
6651231Ssheldonh		;;
6751231Ssheldonh	esac
6833439Sguido
6951231Ssheldonh	case ${gateway_enable} in
7051231Ssheldonh	[Yy][Ee][Ss])
7151231Ssheldonh		echo -n ' IP gateway=YES'
7287646Sru		sysctl net.inet.ip.forwarding=1 >/dev/null
7351231Ssheldonh		;;
7451231Ssheldonh	esac
7533439Sguido
7651231Ssheldonh	case ${forward_sourceroute} in
7751231Ssheldonh	[Yy][Ee][Ss])
7851231Ssheldonh		echo -n ' do source routing=YES'
7987646Sru		sysctl net.inet.ip.sourceroute=1 >/dev/null
8051231Ssheldonh		;;
8151231Ssheldonh	esac
8247752Sphk
8351231Ssheldonh	case ${accept_sourceroute} in
8451231Ssheldonh	[Yy][Ee][Ss])
8551231Ssheldonh		echo -n ' accept source routing=YES'
8687646Sru		sysctl net.inet.ip.accept_sourceroute=1 >/dev/null
8751231Ssheldonh		;;
8851231Ssheldonh	esac
8951209Sdes
9051231Ssheldonh	case ${tcp_keepalive} in
9187500Srwatson	[Nn][Oo])
9287500Srwatson		echo -n ' TCP keepalive=NO'
9387646Sru		sysctl net.inet.tcp.always_keepalive=0 >/dev/null
9451231Ssheldonh		;;
9551231Ssheldonh	esac
9651209Sdes
9751231Ssheldonh	case ${tcp_drop_synfin} in
9851231Ssheldonh	[Yy][Ee][Ss])
9951231Ssheldonh		echo -n ' drop SYN+FIN packets=YES'
10087646Sru		sysctl net.inet.tcp.drop_synfin=1 >/dev/null
10151231Ssheldonh		;;
10251231Ssheldonh	esac
10336174Sjkh
10451231Ssheldonh	case ${ipxgateway_enable} in
10551231Ssheldonh	[Yy][Ee][Ss])
10651231Ssheldonh		echo -n ' IPX gateway=YES'
10787646Sru		sysctl net.ipx.ipx.ipxforwarding=1 >/dev/null
10851231Ssheldonh		;;
10951231Ssheldonh	esac
11051231Ssheldonh
11151231Ssheldonh	case ${arpproxy_all} in
11251231Ssheldonh	[Yy][Ee][Ss])
11351231Ssheldonh		echo -n ' ARP proxyall=YES'
11487646Sru		sysctl net.link.ether.inet.proxyall=1 >/dev/null
11551231Ssheldonh		;;
11651231Ssheldonh	esac
11761961Sdillon
11861961Sdillon	case ${ip_portrange_first} in
11961961Sdillon	[Nn][Oo] | '')
12061961Sdillon		;;
12161961Sdillon	*)
12267012Sru		echo -n " ip_portrange_first=$ip_portrange_first"
12387646Sru		sysctl net.inet.ip.portrange.first=$ip_portrange_first >/dev/null
12461961Sdillon		;;
12561961Sdillon	esac
12661961Sdillon
12761961Sdillon	case ${ip_portrange_last} in
12861961Sdillon	[Nn][Oo] | '')
12964731Sjhb		;;
13061961Sdillon	*)
13167012Sru		echo -n " ip_portrange_last=$ip_portrange_last"
13287646Sru		sysctl net.inet.ip.portrange.last=$ip_portrange_last >/dev/null
13361961Sdillon		;;
13461961Sdillon	esac
13561961Sdillon
13651231Ssheldonh	echo '.'
13725184Sjkh}
13825184Sjkh
139100280Sgordonload_rc_config $name
140100280Sgordonrun_rc_command "$1"
141