defaultroute revision 113676
1240116Smarcel#!/bin/sh
2240116Smarcel#
3240116Smarcel# Configure routing and miscellaneous network tunables
4240116Smarcel#
5240116Smarcel# $FreeBSD: head/etc/rc.d/routing 113676 2003-04-18 17:55:05Z mtm $
6240116Smarcel#
7240116Smarcel
8240116Smarcel# PROVIDE: network2
9240116Smarcel# REQUIRE: netif ppp-user
10240116Smarcel# KEYWORD: FreeBSD
11240116Smarcel
12240116Smarcel. /etc/rc.subr
13240116Smarcel
14240116Smarcelname="network2"
15240116Smarcelstart_cmd="network2_start"
16240116Smarcelstop_cmd=":"
17240116Smarcel
18240116Smarcelnetwork2_start()
19240116Smarcel{
20240116Smarcel	case ${defaultrouter} in
21240116Smarcel	[Nn][Oo] | '')
22240116Smarcel		;;
23240116Smarcel	*)
24240116Smarcel		static_routes="default ${static_routes}"
25240116Smarcel		route_default="default ${defaultrouter}"
26240116Smarcel		;;
27240116Smarcel	esac
28240116Smarcel
29240116Smarcel	# Setup static routes. This should be done before router discovery.
30240116Smarcel	#
31240116Smarcel	if [ -n "${static_routes}" ]; then
32240116Smarcel		for i in ${static_routes}; do
33240116Smarcel			eval route_args=\$route_${i}
34240116Smarcel			route add ${route_args}
35240116Smarcel		done
36240116Smarcel	fi
37240116Smarcel
38240116Smarcel	echo -n 'Additional routing options:'
39240116Smarcel	case ${tcp_extensions} in
40240116Smarcel	[Yy][Ee][Ss] | '')
41240116Smarcel		;;
42240116Smarcel	*)
43240116Smarcel		echo -n ' tcp extensions=NO'
44240116Smarcel		sysctl net.inet.tcp.rfc1323=0 >/dev/null
45240116Smarcel		;;
46240116Smarcel	esac
47240116Smarcel
48240116Smarcel	case ${icmp_bmcastecho} in
49240116Smarcel	[Yy][Ee][Ss])
50240116Smarcel		echo -n ' broadcast ping responses=YES'
51240116Smarcel		sysctl net.inet.icmp.bmcastecho=1 >/dev/null
52240116Smarcel		;;
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