2002-07-18 05:00:17 +00:00
|
|
|
#!/bin/sh
|
1997-04-27 03:59:19 +00:00
|
|
|
#
|
2002-07-18 05:00:17 +00:00
|
|
|
# Configure routing and miscellaneous network tunables
|
2000-10-08 19:20:36 +00:00
|
|
|
#
|
1999-08-27 23:37:10 +00:00
|
|
|
# $FreeBSD$
|
2000-10-08 19:20:36 +00:00
|
|
|
#
|
1997-04-27 03:59:19 +00:00
|
|
|
|
2003-06-29 05:09:48 +00:00
|
|
|
# PROVIDE: routing
|
2003-04-18 17:55:05 +00:00
|
|
|
# REQUIRE: netif ppp-user
|
2002-07-18 05:00:17 +00:00
|
|
|
# KEYWORD: FreeBSD
|
2001-06-03 12:26:56 +00:00
|
|
|
|
2002-07-18 05:00:17 +00:00
|
|
|
. /etc/rc.subr
|
1999-09-13 15:44:20 +00:00
|
|
|
|
2003-06-29 05:09:48 +00:00
|
|
|
name="routing"
|
|
|
|
start_cmd="routing_start"
|
|
|
|
stop_cmd="routing_stop"
|
|
|
|
extra_commands="options static"
|
|
|
|
static_cmd="static_start"
|
|
|
|
options_cmd="options_start"
|
1999-12-12 01:58:30 +00:00
|
|
|
|
2003-06-29 05:09:48 +00:00
|
|
|
routing_start()
|
|
|
|
{
|
|
|
|
static_start
|
|
|
|
options_start
|
|
|
|
}
|
|
|
|
|
|
|
|
routing_stop()
|
|
|
|
{
|
|
|
|
route -n flush
|
|
|
|
}
|
|
|
|
|
|
|
|
static_start()
|
2002-07-18 05:00:17 +00:00
|
|
|
{
|
1999-09-13 15:44:20 +00:00
|
|
|
case ${defaultrouter} in
|
|
|
|
[Nn][Oo] | '')
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
static_routes="default ${static_routes}"
|
|
|
|
route_default="default ${defaultrouter}"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2002-07-18 05:00:17 +00:00
|
|
|
# Setup static routes. This should be done before router discovery.
|
1999-09-13 15:44:20 +00:00
|
|
|
#
|
|
|
|
if [ -n "${static_routes}" ]; then
|
|
|
|
for i in ${static_routes}; do
|
|
|
|
eval route_args=\$route_${i}
|
2003-06-29 05:09:48 +00:00
|
|
|
echo route add ${route_args}
|
1999-09-13 15:44:20 +00:00
|
|
|
done
|
|
|
|
fi
|
2003-06-29 05:09:48 +00:00
|
|
|
}
|
1999-09-13 15:44:20 +00:00
|
|
|
|
2003-06-29 05:09:48 +00:00
|
|
|
options_start()
|
|
|
|
{
|
1999-09-13 15:44:20 +00:00
|
|
|
echo -n 'Additional routing options:'
|
|
|
|
case ${tcp_extensions} in
|
|
|
|
[Yy][Ee][Ss] | '')
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo -n ' tcp extensions=NO'
|
2001-12-11 08:21:46 +00:00
|
|
|
sysctl net.inet.tcp.rfc1323=0 >/dev/null
|
1999-09-13 15:44:20 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case ${icmp_bmcastecho} in
|
|
|
|
[Yy][Ee][Ss])
|
|
|
|
echo -n ' broadcast ping responses=YES'
|
2001-12-11 08:21:46 +00:00
|
|
|
sysctl net.inet.icmp.bmcastecho=1 >/dev/null
|
1999-09-13 15:44:20 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case ${icmp_drop_redirect} in
|
|
|
|
[Yy][Ee][Ss])
|
|
|
|
echo -n ' ignore ICMP redirect=YES'
|
2001-12-11 08:21:46 +00:00
|
|
|
sysctl net.inet.icmp.drop_redirect=1 >/dev/null
|
1999-09-13 15:44:20 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case ${icmp_log_redirect} in
|
|
|
|
[Yy][Ee][Ss])
|
|
|
|
echo -n ' log ICMP redirect=YES'
|
2001-12-11 08:21:46 +00:00
|
|
|
sysctl net.inet.icmp.log_redirect=1 >/dev/null
|
1999-09-13 15:44:20 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case ${gateway_enable} in
|
|
|
|
[Yy][Ee][Ss])
|
|
|
|
echo -n ' IP gateway=YES'
|
2001-12-11 08:21:46 +00:00
|
|
|
sysctl net.inet.ip.forwarding=1 >/dev/null
|
1999-09-13 15:44:20 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case ${forward_sourceroute} in
|
|
|
|
[Yy][Ee][Ss])
|
|
|
|
echo -n ' do source routing=YES'
|
2001-12-11 08:21:46 +00:00
|
|
|
sysctl net.inet.ip.sourceroute=1 >/dev/null
|
1999-09-13 15:44:20 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case ${accept_sourceroute} in
|
|
|
|
[Yy][Ee][Ss])
|
|
|
|
echo -n ' accept source routing=YES'
|
2001-12-11 08:21:46 +00:00
|
|
|
sysctl net.inet.ip.accept_sourceroute=1 >/dev/null
|
1999-09-13 15:44:20 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case ${tcp_keepalive} in
|
2001-12-07 17:03:14 +00:00
|
|
|
[Nn][Oo])
|
|
|
|
echo -n ' TCP keepalive=NO'
|
2001-12-11 08:21:46 +00:00
|
|
|
sysctl net.inet.tcp.always_keepalive=0 >/dev/null
|
1999-09-13 15:44:20 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case ${tcp_drop_synfin} in
|
|
|
|
[Yy][Ee][Ss])
|
|
|
|
echo -n ' drop SYN+FIN packets=YES'
|
2001-12-11 08:21:46 +00:00
|
|
|
sysctl net.inet.tcp.drop_synfin=1 >/dev/null
|
1999-09-13 15:44:20 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case ${ipxgateway_enable} in
|
|
|
|
[Yy][Ee][Ss])
|
|
|
|
echo -n ' IPX gateway=YES'
|
2001-12-11 08:21:46 +00:00
|
|
|
sysctl net.ipx.ipx.ipxforwarding=1 >/dev/null
|
1999-09-13 15:44:20 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case ${arpproxy_all} in
|
|
|
|
[Yy][Ee][Ss])
|
|
|
|
echo -n ' ARP proxyall=YES'
|
2001-12-11 08:21:46 +00:00
|
|
|
sysctl net.link.ether.inet.proxyall=1 >/dev/null
|
1999-09-13 15:44:20 +00:00
|
|
|
;;
|
|
|
|
esac
|
2000-06-22 17:40:53 +00:00
|
|
|
|
|
|
|
case ${ip_portrange_first} in
|
|
|
|
[Nn][Oo] | '')
|
|
|
|
;;
|
|
|
|
*)
|
2000-10-12 11:25:57 +00:00
|
|
|
echo -n " ip_portrange_first=$ip_portrange_first"
|
2001-12-11 08:21:46 +00:00
|
|
|
sysctl net.inet.ip.portrange.first=$ip_portrange_first >/dev/null
|
2000-06-22 17:40:53 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case ${ip_portrange_last} in
|
|
|
|
[Nn][Oo] | '')
|
2000-08-16 23:08:28 +00:00
|
|
|
;;
|
2000-06-22 17:40:53 +00:00
|
|
|
*)
|
2000-10-12 11:25:57 +00:00
|
|
|
echo -n " ip_portrange_last=$ip_portrange_last"
|
2001-12-11 08:21:46 +00:00
|
|
|
sysctl net.inet.ip.portrange.last=$ip_portrange_last >/dev/null
|
2000-06-22 17:40:53 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
1999-09-13 15:44:20 +00:00
|
|
|
echo '.'
|
1997-04-27 03:59:19 +00:00
|
|
|
}
|
|
|
|
|
2002-07-18 05:00:17 +00:00
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|