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"
|
|
|
|
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}"
|
2009-10-02 08:51:39 +02:00
|
|
|
${SYSCTL_W} net.inet.tcp.log_in_vain=${log_in_vain} >/dev/null
|
|
|
|
${SYSCTL_W} net.inet.udp.log_in_vain=${log_in_vain} >/dev/null
|
|
|
|
;;
|
|
|
|
*)
|
2009-10-02 04:27:49 +02:00
|
|
|
${SYSCTL_W} net.inet.tcp.log_in_vain=0 >/dev/null
|
|
|
|
${SYSCTL_W} 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
|
2009-10-02 04:27:49 +02:00
|
|
|
${SYSCTL_W} net.inet.tcp.rfc1323=1 >/dev/null
|
|
|
|
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}"
|
2009-09-13 00:17:52 +02:00
|
|
|
${SYSCTL_W} net.inet.tcp.rfc1323=0 >/dev/null
|
|
|
|
fi
|
2002-07-18 07:00:17 +02:00
|
|
|
|
2009-10-02 04:27:49 +02:00
|
|
|
if checkyesno tcp_keepalive; then
|
|
|
|
${SYSCTL_W} net.inet.tcp.always_keepalive=1 >/dev/null
|
|
|
|
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}"
|
2009-09-13 00:17:52 +02:00
|
|
|
${SYSCTL_W} net.inet.tcp.always_keepalive=0 >/dev/null
|
|
|
|
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}"
|
2009-09-13 00:17:52 +02:00
|
|
|
${SYSCTL_W} net.inet.tcp.drop_synfin=1 >/dev/null
|
2009-10-02 04:27:49 +02:00
|
|
|
else
|
|
|
|
${SYSCTL_W} 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"
|
|
|
|
${SYSCTL_W} net.inet.ip.portrange.first=$ip_portrange_first >/dev/null
|
|
|
|
;;
|
|
|
|
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"
|
|
|
|
${SYSCTL_W} net.inet.ip.portrange.last=$ip_portrange_last >/dev/null
|
|
|
|
;;
|
|
|
|
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}"
|
|
|
|
${SYSCTL_W} net.inet6.ip6.v6only=0 >/dev/null
|
|
|
|
else
|
|
|
|
${SYSCTL_W} net.inet6.ip6.v6only=1 >/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
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command $1
|