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()
|
|
|
|
{
|
|
|
|
if checkyesno log_in_vain; then
|
|
|
|
netoptions_init
|
|
|
|
echo -n " log_in_vain=${log_in_vain}"
|
|
|
|
${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
|
|
|
|
fi
|
2002-07-18 05:00:17 +00:00
|
|
|
|
2009-09-12 22:17:52 +00:00
|
|
|
if checkyesno tcp_extensions; then
|
|
|
|
netoptions_init
|
|
|
|
echo -n ' rfc1323 extensions=NO'
|
|
|
|
${SYSCTL_W} net.inet.tcp.rfc1323=0 >/dev/null
|
|
|
|
fi
|
2002-07-18 05:00:17 +00:00
|
|
|
|
2009-09-12 22:17:52 +00:00
|
|
|
if ! checkyesno tcp_keepalive; then
|
|
|
|
netoptions_init
|
|
|
|
echo -n ' TCP keepalive=NO'
|
|
|
|
${SYSCTL_W} net.inet.tcp.always_keepalive=0 >/dev/null
|
|
|
|
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
|
|
|
|
echo -n ' drop SYN+FIN packets=YES'
|
|
|
|
${SYSCTL_W} net.inet.tcp.drop_synfin=1 >/dev/null
|
|
|
|
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"
|
|
|
|
${SYSCTL_W} net.inet.ip.portrange.first=$ip_portrange_first >/dev/null
|
|
|
|
;;
|
|
|
|
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"
|
|
|
|
${SYSCTL_W} net.inet.ip.portrange.last=$ip_portrange_last >/dev/null
|
|
|
|
;;
|
|
|
|
esac
|
2007-05-02 15:49:30 +00:00
|
|
|
|
2009-09-30 14:58:10 +00:00
|
|
|
if afexists inet6; then
|
|
|
|
if checkyesno ipv6_ipv4mapping; then
|
|
|
|
${SYSCTL_W} net.inet6.ip6.v6only=0 >/dev/null
|
|
|
|
else
|
|
|
|
echo -n " no-ipv4-mapped-ipv6"
|
|
|
|
${SYSCTL_W} net.inet6.ip6.v6only=1 >/dev/null
|
|
|
|
fi
|
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
|
|
|
[ -n "${_netoptions_initdone}" ] && echo '.'
|
|
|
|
}
|
2007-05-02 15:49:30 +00:00
|
|
|
|
2009-09-12 22:17:52 +00:00
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command $1
|