From owner-svn-src-head@FreeBSD.ORG Fri Oct 2 02:27:49 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE9ED106566B; Fri, 2 Oct 2009 02:27:49 +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 C42B58FC15; Fri, 2 Oct 2009 02:27:49 +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 n922Rn8h086219; Fri, 2 Oct 2009 02:27:49 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n922RnBd086217; Fri, 2 Oct 2009 02:27:49 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <200910020227.n922RnBd086217@svn.freebsd.org> From: Hiroki Sato Date: Fri, 2 Oct 2009 02:27:49 +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: r197698 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2009 02:27:50 -0000 Author: hrs Date: Fri Oct 2 02:27:49 2009 New Revision: 197698 URL: http://svn.freebsd.org/changeset/base/197698 Log: - Fix logic inversion bug of net.inet.tcp.rfc1323[*]. - Split netoptions_start() to netoptions_AF() and add afexists() check for each address family. - Display a message only if the user sets a non-default value, and set a sysctl explicitly even if it is the default value. Spotted by: Pegasus Mc Cleaft[*] Modified: head/etc/rc.d/netoptions Modified: head/etc/rc.d/netoptions ============================================================================== --- head/etc/rc.d/netoptions Fri Oct 2 02:24:25 2009 (r197697) +++ head/etc/rc.d/netoptions Fri Oct 2 02:27:49 2009 (r197698) @@ -26,29 +26,48 @@ netoptions_init() netoptions_start() { + local _af + + for _af in inet inet6; do + afexists ${_af} && eval netoptions_${_af} + done + [ -n "${_netoptions_initdone}" ] && echo '.' +} + +netoptions_inet() +{ 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 + ${SYSCTL_W} net.inet.tcp.log_in_vain=1 >/dev/null + ${SYSCTL_W} net.inet.udp.log_in_vain=1 >/dev/null + else + ${SYSCTL_W} net.inet.tcp.log_in_vain=0 >/dev/null + ${SYSCTL_W} net.inet.udp.log_in_vain=0 >/dev/null fi if checkyesno tcp_extensions; then + ${SYSCTL_W} net.inet.tcp.rfc1323=1 >/dev/null + else netoptions_init - echo -n ' rfc1323 extensions=NO' + echo -n ' rfc1323 extensions=${tcp_extensions}' ${SYSCTL_W} net.inet.tcp.rfc1323=0 >/dev/null fi - if ! checkyesno tcp_keepalive; then + if checkyesno tcp_keepalive; then + ${SYSCTL_W} net.inet.tcp.always_keepalive=1 >/dev/null + else netoptions_init - echo -n ' TCP keepalive=NO' + echo -n ' TCP keepalive=${tcp_keepalive}' ${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' + echo -n ' drop SYN+FIN packets=${tcp_drop_synfin}' ${SYSCTL_W} net.inet.tcp.drop_synfin=1 >/dev/null + else + ${SYSCTL_W} net.inet.tcp.drop_synfin=0 >/dev/null fi case ${ip_portrange_first} in @@ -66,17 +85,17 @@ netoptions_start() ${SYSCTL_W} net.inet.ip.portrange.last=$ip_portrange_last >/dev/null ;; esac +} - 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 +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 fi - - [ -n "${_netoptions_initdone}" ] && echo '.' } load_rc_config $name