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