2002-07-18 05:00:17 +00:00
|
|
|
#!/bin/sh
|
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: netoptions
|
2007-05-02 15:32:05 +00:00
|
|
|
# REQUIRE: FILESYSTEMS
|
2009-09-12 22:17:52 +00:00
|
|
|
# BEFORE: netif
|
2004-10-07 13:55:26 +00:00
|
|
|
# KEYWORD: nojail
|
2002-07-18 05:00:17 +00:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
2009-09-30 14:58:10 +00:00
|
|
|
. /etc/network.subr
|
2002-07-18 05:00:17 +00:00
|
|
|
|
2009-09-12 22:17:52 +00:00
|
|
|
name="netoptions"
|
|
|
|
start_cmd="netoptions_start"
|
|
|
|
stop_cmd=:
|
|
|
|
|
2008-06-23 04:00:45 +00:00
|
|
|
_netoptions_initdone=
|
|
|
|
netoptions_init()
|
|
|
|
{
|
|
|
|
if [ -z "${_netoptions_initdone}" ]; then
|
|
|
|
echo -n 'Additional TCP/IP options:'
|
|
|
|
_netoptions_initdone=yes
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2009-09-12 22:17:52 +00:00
|
|
|
netoptions_start()
|
2009-10-02 02:27:49 +00:00
|
|
|
{
|
|
|
|
local _af
|
|
|
|
|
|
|
|
for _af in inet inet6; do
|
|
|
|
afexists ${_af} && eval netoptions_${_af}
|
|
|
|
done
|
|
|
|
[ -n "${_netoptions_initdone}" ] && echo '.'
|
|
|
|
}
|
|
|
|
|
|
|
|
netoptions_inet()
|
2009-09-12 22:17:52 +00:00
|
|
|
{
|
2009-10-02 06:51:39 +00:00
|
|
|
case ${log_in_vain} in
|
|
|
|
[12])
|
2009-09-12 22:17:52 +00:00
|
|
|
netoptions_init
|
|
|
|
echo -n " log_in_vain=${log_in_vain}"
|
2011-03-30 01:19:00 +00:00
|
|
|
${SYSCTL} net.inet.tcp.log_in_vain=${log_in_vain} >/dev/null
|
|
|
|
${SYSCTL} net.inet.udp.log_in_vain=${log_in_vain} >/dev/null
|
2009-10-02 06:51:39 +00:00
|
|
|
;;
|
|
|
|
*)
|
2011-03-30 01:19:00 +00:00
|
|
|
${SYSCTL} net.inet.tcp.log_in_vain=0 >/dev/null
|
|
|
|
${SYSCTL} net.inet.udp.log_in_vain=0 >/dev/null
|
2009-10-02 06:51:39 +00:00
|
|
|
;;
|
|
|
|
esac
|
2002-07-18 05:00:17 +00:00
|
|
|
|
2009-09-12 22:17:52 +00:00
|
|
|
if checkyesno tcp_extensions; then
|
2011-03-30 01:19:00 +00:00
|
|
|
${SYSCTL} net.inet.tcp.rfc1323=1 >/dev/null
|
2009-10-02 02:27:49 +00:00
|
|
|
else
|
2009-09-12 22:17:52 +00:00
|
|
|
netoptions_init
|
2009-10-23 09:30:19 +00:00
|
|
|
echo -n " rfc1323 extensions=${tcp_extensions}"
|
2011-03-30 01:19:00 +00:00
|
|
|
${SYSCTL} net.inet.tcp.rfc1323=0 >/dev/null
|
2009-09-12 22:17:52 +00:00
|
|
|
fi
|
2002-07-18 05:00:17 +00:00
|
|
|
|
2009-10-02 02:27:49 +00:00
|
|
|
if checkyesno tcp_keepalive; then
|
2011-03-30 01:19:00 +00:00
|
|
|
${SYSCTL} net.inet.tcp.always_keepalive=1 >/dev/null
|
2009-10-02 02:27:49 +00:00
|
|
|
else
|
2009-09-12 22:17:52 +00:00
|
|
|
netoptions_init
|
2009-10-23 09:30:19 +00:00
|
|
|
echo -n " TCP keepalive=${tcp_keepalive}"
|
2011-03-30 01:19:00 +00:00
|
|
|
${SYSCTL} net.inet.tcp.always_keepalive=0 >/dev/null
|
2009-09-12 22:17:52 +00:00
|
|
|
fi
|
2007-05-02 15:49:30 +00:00
|
|
|
|
2009-09-12 22:17:52 +00:00
|
|
|
if checkyesno tcp_drop_synfin; then
|
|
|
|
netoptions_init
|
2009-10-23 09:30:19 +00:00
|
|
|
echo -n " drop SYN+FIN packets=${tcp_drop_synfin}"
|
2011-03-30 01:19:00 +00:00
|
|
|
${SYSCTL} net.inet.tcp.drop_synfin=1 >/dev/null
|
2009-10-02 02:27:49 +00:00
|
|
|
else
|
2011-03-30 01:19:00 +00:00
|
|
|
${SYSCTL} net.inet.tcp.drop_synfin=0 >/dev/null
|
2009-09-12 22:17:52 +00:00
|
|
|
fi
|
2007-05-02 15:49:30 +00:00
|
|
|
|
2009-09-12 22:17:52 +00:00
|
|
|
case ${ip_portrange_first} in
|
|
|
|
[0-9]*)
|
|
|
|
netoptions_init
|
|
|
|
echo -n " ip_portrange_first=$ip_portrange_first"
|
2011-03-30 01:19:00 +00:00
|
|
|
${SYSCTL} net.inet.ip.portrange.first=$ip_portrange_first >/dev/null
|
2009-09-12 22:17:52 +00:00
|
|
|
;;
|
|
|
|
esac
|
2007-05-02 15:49:30 +00:00
|
|
|
|
2009-09-12 22:17:52 +00:00
|
|
|
case ${ip_portrange_last} in
|
|
|
|
[0-9]*)
|
|
|
|
netoptions_init
|
|
|
|
echo -n " ip_portrange_last=$ip_portrange_last"
|
2011-03-30 01:19:00 +00:00
|
|
|
${SYSCTL} net.inet.ip.portrange.last=$ip_portrange_last >/dev/null
|
2009-09-12 22:17:52 +00:00
|
|
|
;;
|
|
|
|
esac
|
2009-10-02 02:27:49 +00:00
|
|
|
}
|
2007-05-02 15:49:30 +00:00
|
|
|
|
2009-10-02 02:27:49 +00:00
|
|
|
netoptions_inet6()
|
|
|
|
{
|
|
|
|
if checkyesno ipv6_ipv4mapping; then
|
|
|
|
netoptions_init
|
|
|
|
echo -n " ipv4-mapped-ipv6=${ipv6_ipv4mapping}"
|
2011-03-30 01:19:00 +00:00
|
|
|
${SYSCTL} net.inet6.ip6.v6only=0 >/dev/null
|
2009-10-02 02:27:49 +00:00
|
|
|
else
|
2011-03-30 01:19:00 +00:00
|
|
|
${SYSCTL} net.inet6.ip6.v6only=1 >/dev/null
|
2009-09-12 22:17:52 +00:00
|
|
|
fi
|
2010-09-13 19:52:46 +00:00
|
|
|
|
|
|
|
if checkyesno ipv6_privacy; then
|
|
|
|
netoptions_init
|
|
|
|
echo -n " IPv6 Privacy Addresses"
|
2011-03-30 01:19:00 +00:00
|
|
|
${SYSCTL} net.inet6.ip6.use_tempaddr=1 >/dev/null
|
|
|
|
${SYSCTL} net.inet6.ip6.prefer_tempaddr=1 >/dev/null
|
2010-09-13 19:52:46 +00:00
|
|
|
fi
|
2011-09-13 00:06:11 +00:00
|
|
|
|
|
|
|
case $ipv6_cpe_wanif in
|
|
|
|
""|[Nn][Oo]|[Nn][Oo][Nn][Ee]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
|
|
|
|
${SYSCTL} net.inet6.ip6.no_radr=0 >/dev/null
|
|
|
|
${SYSCTL} net.inet6.ip6.rfc6204w3=0 >/dev/null
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
netoptions_init
|
|
|
|
echo -n " IPv6 CPE WANIF=${ipv6_cpe_wanif}"
|
|
|
|
${SYSCTL} net.inet6.ip6.no_radr=1 >/dev/null
|
|
|
|
${SYSCTL} net.inet6.ip6.rfc6204w3=1 >/dev/null
|
|
|
|
;;
|
|
|
|
esac
|
2009-09-12 22:17:52 +00:00
|
|
|
}
|
2007-05-02 15:49:30 +00:00
|
|
|
|
2009-09-12 22:17:52 +00:00
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command $1
|