defaultroute revision 100280
1#!/bin/sh
2#
3# Configure routing and miscellaneous network tunables
4#
5# $FreeBSD: head/etc/rc.d/routing 100280 2002-07-18 05:00:17Z gordon $
6#
7
8# PROVIDE: network2
9# REQUIRE: network1 ppp-user
10# KEYWORD: FreeBSD
11
12. /etc/rc.subr
13
14name="network2"
15start_cmd="network2_start"
16stop_cmd=":"
17
18network2_start()
19{
20	case ${defaultrouter} in
21	[Nn][Oo] | '')
22		;;
23	*)
24		static_routes="default ${static_routes}"
25		route_default="default ${defaultrouter}"
26		;;
27	esac
28
29	# Setup static routes. This should be done before router discovery.
30	#
31	if [ -n "${static_routes}" ]; then
32		for i in ${static_routes}; do
33			eval route_args=\$route_${i}
34			route add ${route_args}
35		done
36	fi
37
38	echo -n 'Additional routing options:'
39	case ${tcp_extensions} in
40	[Yy][Ee][Ss] | '')
41		;;
42	*)
43		echo -n ' tcp extensions=NO'
44		sysctl net.inet.tcp.rfc1323=0 >/dev/null
45		;;
46	esac
47
48	case ${icmp_bmcastecho} in
49	[Yy][Ee][Ss])
50		echo -n ' broadcast ping responses=YES'
51		sysctl net.inet.icmp.bmcastecho=1 >/dev/null
52		;;
53	esac
54
55	case ${icmp_drop_redirect} in
56	[Yy][Ee][Ss])
57		echo -n ' ignore ICMP redirect=YES'
58		sysctl net.inet.icmp.drop_redirect=1 >/dev/null
59		;;
60	esac
61
62	case ${icmp_log_redirect} in
63	[Yy][Ee][Ss])
64		echo -n ' log ICMP redirect=YES'
65		sysctl net.inet.icmp.log_redirect=1 >/dev/null
66		;;
67	esac
68
69	case ${gateway_enable} in
70	[Yy][Ee][Ss])
71		echo -n ' IP gateway=YES'
72		sysctl net.inet.ip.forwarding=1 >/dev/null
73		;;
74	esac
75
76	case ${forward_sourceroute} in
77	[Yy][Ee][Ss])
78		echo -n ' do source routing=YES'
79		sysctl net.inet.ip.sourceroute=1 >/dev/null
80		;;
81	esac
82
83	case ${accept_sourceroute} in
84	[Yy][Ee][Ss])
85		echo -n ' accept source routing=YES'
86		sysctl net.inet.ip.accept_sourceroute=1 >/dev/null
87		;;
88	esac
89
90	case ${tcp_keepalive} in
91	[Nn][Oo])
92		echo -n ' TCP keepalive=NO'
93		sysctl net.inet.tcp.always_keepalive=0 >/dev/null
94		;;
95	esac
96
97	case ${tcp_drop_synfin} in
98	[Yy][Ee][Ss])
99		echo -n ' drop SYN+FIN packets=YES'
100		sysctl net.inet.tcp.drop_synfin=1 >/dev/null
101		;;
102	esac
103
104	case ${ipxgateway_enable} in
105	[Yy][Ee][Ss])
106		echo -n ' IPX gateway=YES'
107		sysctl net.ipx.ipx.ipxforwarding=1 >/dev/null
108		;;
109	esac
110
111	case ${arpproxy_all} in
112	[Yy][Ee][Ss])
113		echo -n ' ARP proxyall=YES'
114		sysctl net.link.ether.inet.proxyall=1 >/dev/null
115		;;
116	esac
117
118	case ${ip_portrange_first} in
119	[Nn][Oo] | '')
120		;;
121	*)
122		echo -n " ip_portrange_first=$ip_portrange_first"
123		sysctl net.inet.ip.portrange.first=$ip_portrange_first >/dev/null
124		;;
125	esac
126
127	case ${ip_portrange_last} in
128	[Nn][Oo] | '')
129		;;
130	*)
131		echo -n " ip_portrange_last=$ip_portrange_last"
132		sysctl net.inet.ip.portrange.last=$ip_portrange_last >/dev/null
133		;;
134	esac
135
136	echo '.'
137}
138
139load_rc_config $name
140run_rc_command "$1"
141