diff options
author | hrs <hrs@FreeBSD.org> | 2009-09-12 22:17:52 +0000 |
---|---|---|
committer | hrs <hrs@FreeBSD.org> | 2009-09-12 22:17:52 +0000 |
commit | cc29e78397759e3f12b8587351da540a33307d95 (patch) | |
tree | eefed005b53e7742a1832179c3b36616dbecacf2 | |
parent | c74a8dcde61d06a7d6b328d09172687daa2c8603 (diff) | |
download | FreeBSD-src-cc29e78397759e3f12b8587351da540a33307d95.zip FreeBSD-src-cc29e78397759e3f12b8587351da540a33307d95.tar.gz |
Use RCng coding convention.
MFC after: 3 days
-rwxr-xr-x | etc/rc.d/netoptions | 116 |
1 files changed, 52 insertions, 64 deletions
diff --git a/etc/rc.d/netoptions b/etc/rc.d/netoptions index 7b02c50..593333a 100755 --- a/etc/rc.d/netoptions +++ b/etc/rc.d/netoptions @@ -5,10 +5,15 @@ # PROVIDE: netoptions # REQUIRE: FILESYSTEMS +# BEFORE: netif # KEYWORD: nojail . /etc/rc.subr +name="netoptions" +start_cmd="netoptions_start" +stop_cmd=: + _netoptions_initdone= netoptions_init() { @@ -18,75 +23,58 @@ netoptions_init() fi } -load_rc_config 'XXX' +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 -case ${log_in_vain} in -[Nn][Oo] | '') - log_in_vain=0 - ;; -[Yy][Ee][Ss]) - log_in_vain=1 - ;; -[0-9]*) - ;; -*) - netoptions_init - echo " invalid log_in_vain setting: ${log_in_vain}" - log_in_vain=0 - ;; -esac + if checkyesno tcp_extensions; then + netoptions_init + echo -n ' rfc1323 extensions=NO' + ${SYSCTL_W} net.inet.tcp.rfc1323=0 >/dev/null + fi -if [ "${log_in_vain}" -ne 0 ]; then - netoptions_init - echo -n " log_in_vain=${log_in_vain}" - sysctl net.inet.tcp.log_in_vain="${log_in_vain}" >/dev/null - sysctl net.inet.udp.log_in_vain="${log_in_vain}" >/dev/null -fi + if ! checkyesno tcp_keepalive; then + netoptions_init + echo -n ' TCP keepalive=NO' + ${SYSCTL_W} net.inet.tcp.always_keepalive=0 >/dev/null + fi -case ${tcp_extensions} in -[Yy][Ee][Ss] | '') - ;; -*) - netoptions_init - echo -n ' tcp extensions=NO' - sysctl net.inet.tcp.rfc1323=0 >/dev/null - ;; -esac + 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 -case ${tcp_keepalive} in -[Nn][Oo]) - netoptions_init - echo -n ' TCP keepalive=NO' - sysctl net.inet.tcp.always_keepalive=0 >/dev/null - ;; -esac + 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 -case ${tcp_drop_synfin} in -[Yy][Ee][Ss]) - netoptions_init - echo -n ' drop SYN+FIN packets=YES' - sysctl net.inet.tcp.drop_synfin=1 >/dev/null - ;; -esac + 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 -case ${ip_portrange_first} in -[Nn][Oo] | '') - ;; -*) - netoptions_init - echo -n " ip_portrange_first=$ip_portrange_first" - sysctl net.inet.ip.portrange.first=$ip_portrange_first >/dev/null - ;; -esac + 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 -case ${ip_portrange_last} in -[Nn][Oo] | '') - ;; -*) - netoptions_init - echo -n " ip_portrange_last=$ip_portrange_last" - sysctl net.inet.ip.portrange.last=$ip_portrange_last >/dev/null - ;; -esac + [ -n "${_netoptions_initdone}" ] && echo '.' +} -[ -n "${_netoptions_initdone}" ] && echo '.' +load_rc_config $name +run_rc_command $1 |