From owner-svn-src-all@FreeBSD.ORG Sat Sep 12 22:17:54 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 215C6106566C; Sat, 12 Sep 2009 22:17:53 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 110098FC14; Sat, 12 Sep 2009 22:17:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CMHq02099136; Sat, 12 Sep 2009 22:17:52 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CMHqLb099134; Sat, 12 Sep 2009 22:17:52 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <200909122217.n8CMHqLb099134@svn.freebsd.org> From: Hiroki Sato Date: Sat, 12 Sep 2009 22:17:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197143 - head/etc/rc.d X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2009 22:17:54 -0000 Author: hrs Date: Sat Sep 12 22:17:52 2009 New Revision: 197143 URL: http://svn.freebsd.org/changeset/base/197143 Log: Use RCng coding convention. MFC after: 3 days Modified: head/etc/rc.d/netoptions Modified: head/etc/rc.d/netoptions ============================================================================== --- head/etc/rc.d/netoptions Sat Sep 12 22:17:13 2009 (r197142) +++ head/etc/rc.d/netoptions Sat Sep 12 22:17:52 2009 (r197143) @@ -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 + + if checkyesno tcp_extensions; then + netoptions_init + echo -n ' rfc1323 extensions=NO' + ${SYSCTL_W} net.inet.tcp.rfc1323=0 >/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 + + 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 ${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 [ "${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 - -case ${tcp_extensions} in -[Yy][Ee][Ss] | '') - ;; -*) - netoptions_init - echo -n ' tcp extensions=NO' - sysctl net.inet.tcp.rfc1323=0 >/dev/null - ;; -esac - -case ${tcp_keepalive} in -[Nn][Oo]) - netoptions_init - echo -n ' TCP keepalive=NO' - sysctl net.inet.tcp.always_keepalive=0 >/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_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 - -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 + 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 ${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 + + 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 + + [ -n "${_netoptions_initdone}" ] && echo '.' +} -[ -n "${_netoptions_initdone}" ] && echo '.' +load_rc_config $name +run_rc_command $1