From owner-freebsd-rc@FreeBSD.ORG Sun Jul 17 12:32:53 2011 Return-Path: Delivered-To: freebsd-rc@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A72071065676; Sun, 17 Jul 2011 12:32:53 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) by mx1.freebsd.org (Postfix) with ESMTP id 447268FC1F; Sun, 17 Jul 2011 12:32:53 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id 179101DD62E; Sun, 17 Jul 2011 14:32:52 +0200 (CEST) Received: by turtle.stack.nl (Postfix, from userid 1677) id 005E817512; Sun, 17 Jul 2011 14:32:51 +0200 (CEST) Date: Sun, 17 Jul 2011 14:32:51 +0200 From: Jilles Tjoelker To: Kevin Lo Message-ID: <20110717123251.GA22106@stack.nl> References: <1310623300.37158.8.camel@srgsec> <20110717.033537.180999432921199548.hrs@allbsd.org> <1310869826.2578.5.camel@srgsec> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1310869826.2578.5.camel@srgsec> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Hiroki Sato , freebsd-rc@FreeBSD.org Subject: Re: [patch] /etc/rc.d/routing X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jul 2011 12:32:53 -0000 On Sun, Jul 17, 2011 at 10:30:26AM +0800, Kevin Lo wrote: > On Sun, 2011-07-17 at 03:35 +0900, Hiroki Sato wrote: > > What do you think about the attached change? > Right, jilles@ also pointed out that my change is inconsistent. > Your patch looks good. Tested on -current and it works for me. That patch removes the "echo '.'" at the end of the line. I plan to commit my own patch which does that right and also keeps at one _ropts_initdone variable that is reset in each options_$af function. Index: etc/rc.d/routing =================================================================== --- etc/rc.d/routing (revision 224104) +++ etc/rc.d/routing (working copy) @@ -48,7 +48,6 @@ done ;; esac - [ -n "${_ropts_initdone}" ] && echo '.' } routing_stop() @@ -250,19 +249,19 @@ { } -_ropts_initdone= ropts_init() { if [ -z "${_ropts_initdone}" ]; then - echo -n 'Additional routing options:' + echo -n "Additional $1 routing options:" _ropts_initdone=yes fi } options_inet() { + _ropts_initdone= if checkyesno icmp_bmcastecho; then - ropts_init + ropts_init inet echo -n ' broadcast ping responses=YES' ${SYSCTL} net.inet.icmp.bmcastecho=1 > /dev/null else @@ -270,7 +269,7 @@ fi if checkyesno icmp_drop_redirect; then - ropts_init + ropts_init inet echo -n ' ignore ICMP redirect=YES' ${SYSCTL} net.inet.icmp.drop_redirect=1 > /dev/null else @@ -278,7 +277,7 @@ fi if checkyesno icmp_log_redirect; then - ropts_init + ropts_init inet echo -n ' log ICMP redirect=YES' ${SYSCTL} net.inet.icmp.log_redirect=1 > /dev/null else @@ -286,15 +285,15 @@ fi if checkyesno gateway_enable; then - ropts_init - echo ' IPv4 gateway=YES' + ropts_init inet + echo -n ' gateway=YES' ${SYSCTL} net.inet.ip.forwarding=1 > /dev/null else ${SYSCTL} net.inet.ip.forwarding=0 > /dev/null fi if checkyesno forward_sourceroute; then - ropts_init + ropts_init inet echo -n ' do source routing=YES' ${SYSCTL} net.inet.ip.sourceroute=1 > /dev/null else @@ -302,7 +301,7 @@ fi if checkyesno accept_sourceroute; then - ropts_init + ropts_init inet echo -n ' accept source routing=YES' ${SYSCTL} net.inet.ip.accept_sourceroute=1 > /dev/null else @@ -310,38 +309,51 @@ fi if checkyesno arpproxy_all; then - ropts_init + ropts_init inet echo -n ' ARP proxyall=YES' ${SYSCTL} net.link.ether.inet.proxyall=1 > /dev/null else ${SYSCTL} net.link.ether.inet.proxyall=0 > /dev/null fi + + [ -n "${_ropts_initdone}" ] && echo '.' } options_inet6() { + _ropts_initdone= + if checkyesno ipv6_gateway_enable; then - ropts_init - echo ' IPv6 gateway=YES' + ropts_init inet6 + echo -n ' gateway=YES' ${SYSCTL} net.inet6.ip6.forwarding=1 > /dev/null else ${SYSCTL} net.inet6.ip6.forwarding=0 > /dev/null fi + + [ -n "${_ropts_initdone}" ] && echo '.' } options_atm() { + _ropts_initdone= + + [ -n "${_ropts_initdone}" ] && echo '.' } options_ipx() { + _ropts_initdone= + if checkyesno ipxgateway_enable; then - ropts_init + ropts_init ipx echo -n ' IPX gateway=YES' ${SYSCTL} net.ipx.ipx.ipxforwarding=1 > /dev/null else ${SYSCTL} net.ipx.ipx.ipxforwarding=0 > /dev/null fi + + [ -n "${_ropts_initdone}" ] && echo '.' } load_rc_config $name -- Jilles Tjoelker