On Wed, 30 Mar 2011, Ed Maste wrote:

Author: emaste
Date: Wed Mar 30 01:19:00 2011
New Revision: 220153
URL: http://svn.freebsd.org/changeset/base/220153

Log:
 Replace ${SYSCTL_W} with ${SYSCTL} in rc.d scripts, as they are identical.
 This is a further clean up after r202988.

 SYSCTL_W is still initialized in rc.subr as some ports may still use it.

I think this is a lazyness on our side.  Not sure what the official
reference is but for example OSX really requires the -w to alter a
sysctl while we permit without.   I thin kthe correct fix should have
been to add a -w to SYSCTL_W. That way one can grep for a read vs.
write in the startup scrpits a lot more easily, etc.

No this might be completely counter-intuitive to what we decided to do
in the past in which case I'll just shut up:)

Modified:
 head/etc/rc.d/faith
 head/etc/rc.d/hostid
 head/etc/rc.d/initrandom
 head/etc/rc.d/ipfw
 head/etc/rc.d/jail
 head/etc/rc.d/netoptions
 head/etc/rc.d/routing
 head/etc/rc.d/securelevel

Modified: head/etc/rc.d/faith
==============================================================================
--- head/etc/rc.d/faith Wed Mar 30 01:10:11 2011        (r220152)
+++ head/etc/rc.d/faith Wed Mar 30 01:19:00 2011        (r220153)
@@ -21,7 +21,7 @@ faith_up()
        *)
                echo "Configuring IPv6-to-IPv4 TCP relay capturing interface:" \
                    " faith0."
-               ${SYSCTL_W} net.inet6.ip6.keepfaith=1
+               ${SYSCTL} net.inet6.ip6.keepfaith=1
                ifconfig faith0 create >/dev/null 2>&1
                ifconfig faith0 up
                for prefix in ${ipv6_faith_prefix}; do
@@ -48,7 +48,7 @@ faith_down()
{
        echo "Removing IPv6-to-IPv4 TCP relay capturing interface: faith0."
        ifconfig faith0 destroy
-       ${SYSCTL_W} net.inet6.ip6.keepfaith=0
+       ${SYSCTL} net.inet6.ip6.keepfaith=0

        case ${ipv6_faith_prefix} in
        [Nn][Oo] | '')

Modified: head/etc/rc.d/hostid
==============================================================================
--- head/etc/rc.d/hostid        Wed Mar 30 01:10:11 2011        (r220152)
+++ head/etc/rc.d/hostid        Wed Mar 30 01:19:00 2011        (r220153)
@@ -50,9 +50,9 @@ hostid_set()
        # Set both kern.hostuuid and kern.hostid.
        #
        check_startmsgs && echo "Setting hostuuid: ${uuid}."
-       ${SYSCTL_W} kern.hostuuid="${uuid}" >/dev/null
+       ${SYSCTL} kern.hostuuid="${uuid}" >/dev/null
        check_startmsgs && echo "Setting hostid: ${id}."
-       ${SYSCTL_W} kern.hostid=${id} >/dev/null
+       ${SYSCTL} kern.hostid=${id} >/dev/null
}

hostid_hardware()

Modified: head/etc/rc.d/initrandom
==============================================================================
--- head/etc/rc.d/initrandom    Wed Mar 30 01:10:11 2011        (r220152)
+++ head/etc/rc.d/initrandom    Wed Mar 30 01:19:00 2011        (r220153)
@@ -31,24 +31,24 @@ initrandom_start()

                if [ -w /dev/random ]; then
                        if checkyesno harvest_interrupt; then
-                               ${SYSCTL_W} kern.random.sys.harvest.interrupt=1 
>/dev/null
+                               ${SYSCTL} kern.random.sys.harvest.interrupt=1 
>/dev/null
                                echo -n ' interrupts'
                        else
-                               ${SYSCTL_W} kern.random.sys.harvest.interrupt=0 
>/dev/null
+                               ${SYSCTL} kern.random.sys.harvest.interrupt=0 
>/dev/null
                        fi

                        if checkyesno harvest_ethernet; then
-                               ${SYSCTL_W} kern.random.sys.harvest.ethernet=1 
>/dev/null
+                               ${SYSCTL} kern.random.sys.harvest.ethernet=1 
>/dev/null
                                echo -n ' ethernet'
                        else
-                               ${SYSCTL_W} kern.random.sys.harvest.ethernet=0 
>/dev/null
+                               ${SYSCTL} kern.random.sys.harvest.ethernet=0 
>/dev/null
                        fi

                        if checkyesno harvest_p_to_p; then
-                               ${SYSCTL_W} 
kern.random.sys.harvest.point_to_point=1 >/dev/null
+                               ${SYSCTL} kern.random.sys.harvest.point_to_point=1 
>/dev/null
                                echo -n ' point_to_point'
                        else
-                               ${SYSCTL_W} 
kern.random.sys.harvest.point_to_point=0 >/dev/null
+                               ${SYSCTL} kern.random.sys.harvest.point_to_point=0 
>/dev/null
                        fi
                fi


Modified: head/etc/rc.d/ipfw
==============================================================================
--- head/etc/rc.d/ipfw  Wed Mar 30 01:10:11 2011        (r220152)
+++ head/etc/rc.d/ipfw  Wed Mar 30 01:19:00 2011        (r220153)
@@ -73,11 +73,11 @@ ipfw_poststart()

        # Enable the firewall
        #
-       if ! ${SYSCTL_W} net.inet.ip.fw.enable=1 1>/dev/null 2>&1; then
+       if ! ${SYSCTL} net.inet.ip.fw.enable=1 1>/dev/null 2>&1; then
                warn "failed to enable IPv4 firewall"
        fi
        if afexists inet6; then
-               if ! ${SYSCTL_W} net.inet6.ip6.fw.enable=1 1>/dev/null 2>&1
+               if ! ${SYSCTL} net.inet6.ip6.fw.enable=1 1>/dev/null 2>&1
                then
                        warn "failed to enable IPv6 firewall"
                fi
@@ -90,9 +90,9 @@ ipfw_stop()

        # Disable the firewall
        #
-       ${SYSCTL_W} net.inet.ip.fw.enable=0
+       ${SYSCTL} net.inet.ip.fw.enable=0
        if afexists inet6; then
-               ${SYSCTL_W} net.inet6.ip6.fw.enable=0
+               ${SYSCTL} net.inet6.ip6.fw.enable=0
        fi

        # Stop firewall coscripts

Modified: head/etc/rc.d/jail
==============================================================================
--- head/etc/rc.d/jail  Wed Mar 30 01:10:11 2011        (r220152)
+++ head/etc/rc.d/jail  Wed Mar 30 01:19:00 2011        (r220153)
@@ -219,12 +219,12 @@ set_sysctl()
        if checkyesno $_knob ; then
                if [ "$_current" -ne 1 ]; then
                        echo -n " ${_msg}=YES"
-                       ${SYSCTL_W} 1>/dev/null ${_mib}=1
+                       ${SYSCTL} 1>/dev/null ${_mib}=1
                fi
        else
                if [ "$_current" -ne 0 ]; then
                        echo -n " ${_msg}=NO"
-                       ${SYSCTL_W} 1>/dev/null ${_mib}=0
+                       ${SYSCTL} 1>/dev/null ${_mib}=0
                fi
        fi
}

Modified: head/etc/rc.d/netoptions
==============================================================================
--- head/etc/rc.d/netoptions    Wed Mar 30 01:10:11 2011        (r220152)
+++ head/etc/rc.d/netoptions    Wed Mar 30 01:19:00 2011        (r220153)
@@ -40,44 +40,44 @@ netoptions_inet()
        [12])
                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} net.inet.tcp.log_in_vain=${log_in_vain} >/dev/null
+               ${SYSCTL} net.inet.udp.log_in_vain=${log_in_vain} >/dev/null
                ;;
        *)
-               ${SYSCTL_W} net.inet.tcp.log_in_vain=0 >/dev/null
-               ${SYSCTL_W} net.inet.udp.log_in_vain=0 >/dev/null
+               ${SYSCTL} net.inet.tcp.log_in_vain=0 >/dev/null
+               ${SYSCTL} net.inet.udp.log_in_vain=0 >/dev/null
                ;;
        esac

        if checkyesno tcp_extensions; then
-               ${SYSCTL_W} net.inet.tcp.rfc1323=1 >/dev/null
+               ${SYSCTL} net.inet.tcp.rfc1323=1 >/dev/null
        else
                netoptions_init
                echo -n " rfc1323 extensions=${tcp_extensions}"
-               ${SYSCTL_W} net.inet.tcp.rfc1323=0 >/dev/null
+               ${SYSCTL} net.inet.tcp.rfc1323=0 >/dev/null
        fi

        if checkyesno tcp_keepalive; then
-               ${SYSCTL_W} net.inet.tcp.always_keepalive=1 >/dev/null
+               ${SYSCTL} net.inet.tcp.always_keepalive=1 >/dev/null
        else
                netoptions_init
                echo -n " TCP keepalive=${tcp_keepalive}"
-               ${SYSCTL_W} net.inet.tcp.always_keepalive=0 >/dev/null
+               ${SYSCTL} net.inet.tcp.always_keepalive=0 >/dev/null
        fi

        if checkyesno tcp_drop_synfin; then
                netoptions_init
                echo -n " drop SYN+FIN packets=${tcp_drop_synfin}"
-               ${SYSCTL_W} net.inet.tcp.drop_synfin=1 >/dev/null
+               ${SYSCTL} net.inet.tcp.drop_synfin=1 >/dev/null
        else
-               ${SYSCTL_W} net.inet.tcp.drop_synfin=0 >/dev/null
+               ${SYSCTL} net.inet.tcp.drop_synfin=0 >/dev/null
        fi

        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
+               ${SYSCTL} net.inet.ip.portrange.first=$ip_portrange_first 
>/dev/null
                ;;
        esac

@@ -85,7 +85,7 @@ netoptions_inet()
        [0-9]*)
                netoptions_init
                echo -n " ip_portrange_last=$ip_portrange_last"
-               ${SYSCTL_W} net.inet.ip.portrange.last=$ip_portrange_last 
>/dev/null
+               ${SYSCTL} net.inet.ip.portrange.last=$ip_portrange_last 
>/dev/null
                ;;
        esac
}
@@ -95,16 +95,16 @@ 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
+               ${SYSCTL} net.inet6.ip6.v6only=0 >/dev/null
        else
-               ${SYSCTL_W} net.inet6.ip6.v6only=1 >/dev/null
+               ${SYSCTL} net.inet6.ip6.v6only=1 >/dev/null
        fi

        if checkyesno ipv6_privacy; then
                netoptions_init
                echo -n " IPv6 Privacy Addresses"
-               ${SYSCTL_W} net.inet6.ip6.use_tempaddr=1 >/dev/null
-               ${SYSCTL_W} net.inet6.ip6.prefer_tempaddr=1 >/dev/null
+               ${SYSCTL} net.inet6.ip6.use_tempaddr=1 >/dev/null
+               ${SYSCTL} net.inet6.ip6.prefer_tempaddr=1 >/dev/null
        fi
}


Modified: head/etc/rc.d/routing
==============================================================================
--- head/etc/rc.d/routing       Wed Mar 30 01:10:11 2011        (r220152)
+++ head/etc/rc.d/routing       Wed Mar 30 01:19:00 2011        (r220153)
@@ -264,57 +264,57 @@ options_inet()
        if checkyesno icmp_bmcastecho; then
                ropts_init
                echo -n ' broadcast ping responses=YES'
-               ${SYSCTL_W} net.inet.icmp.bmcastecho=1 > /dev/null
+               ${SYSCTL} net.inet.icmp.bmcastecho=1 > /dev/null
        else
-               ${SYSCTL_W} net.inet.icmp.bmcastecho=0 > /dev/null
+               ${SYSCTL} net.inet.icmp.bmcastecho=0 > /dev/null
        fi

        if checkyesno icmp_drop_redirect; then
                ropts_init
                echo -n ' ignore ICMP redirect=YES'
-               ${SYSCTL_W} net.inet.icmp.drop_redirect=1 > /dev/null
+               ${SYSCTL} net.inet.icmp.drop_redirect=1 > /dev/null
        else
-               ${SYSCTL_W} net.inet.icmp.drop_redirect=0 > /dev/null
+               ${SYSCTL} net.inet.icmp.drop_redirect=0 > /dev/null
        fi

        if checkyesno icmp_log_redirect; then
                ropts_init
                echo -n ' log ICMP redirect=YES'
-               ${SYSCTL_W} net.inet.icmp.log_redirect=1 > /dev/null
+               ${SYSCTL} net.inet.icmp.log_redirect=1 > /dev/null
        else
-               ${SYSCTL_W} net.inet.icmp.log_redirect=0 > /dev/null
+               ${SYSCTL} net.inet.icmp.log_redirect=0 > /dev/null
        fi

        if checkyesno gateway_enable; then
                ropts_init
                echo -n ' IPv4 gateway=YES'
-               ${SYSCTL_W} net.inet.ip.forwarding=1 > /dev/null
+               ${SYSCTL} net.inet.ip.forwarding=1 > /dev/null
        else
-               ${SYSCTL_W} net.inet.ip.forwarding=0 > /dev/null
+               ${SYSCTL} net.inet.ip.forwarding=0 > /dev/null
        fi

        if checkyesno forward_sourceroute; then
                ropts_init
                echo -n ' do source routing=YES'
-               ${SYSCTL_W} net.inet.ip.sourceroute=1 > /dev/null
+               ${SYSCTL} net.inet.ip.sourceroute=1 > /dev/null
        else
-               ${SYSCTL_W} net.inet.ip.sourceroute=0 > /dev/null
+               ${SYSCTL} net.inet.ip.sourceroute=0 > /dev/null
        fi

        if checkyesno accept_sourceroute; then
                ropts_init
                echo -n ' accept source routing=YES'
-               ${SYSCTL_W} net.inet.ip.accept_sourceroute=1 > /dev/null
+               ${SYSCTL} net.inet.ip.accept_sourceroute=1 > /dev/null
        else
-               ${SYSCTL_W} net.inet.ip.accept_sourceroute=0 > /dev/null
+               ${SYSCTL} net.inet.ip.accept_sourceroute=0 > /dev/null
        fi

        if checkyesno arpproxy_all; then
                ropts_init
                echo -n ' ARP proxyall=YES'
-               ${SYSCTL_W} net.link.ether.inet.proxyall=1 > /dev/null
+               ${SYSCTL} net.link.ether.inet.proxyall=1 > /dev/null
        else
-               ${SYSCTL_W} net.link.ether.inet.proxyall=0 > /dev/null
+               ${SYSCTL} net.link.ether.inet.proxyall=0 > /dev/null
        fi
}

@@ -323,9 +323,9 @@ options_inet6()
        if checkyesno ipv6_gateway_enable; then
                ropts_init
                echo -n ' IPv6 gateway=YES'
-               ${SYSCTL_W} net.inet6.ip6.forwarding=1 > /dev/null
+               ${SYSCTL} net.inet6.ip6.forwarding=1 > /dev/null
        else
-               ${SYSCTL_W} net.inet6.ip6.forwarding=0 > /dev/null
+               ${SYSCTL} net.inet6.ip6.forwarding=0 > /dev/null
        fi
}

@@ -338,9 +338,9 @@ options_ipx()
        if checkyesno ipxgateway_enable; then
                ropts_init
                echo -n ' IPX gateway=YES'
-               ${SYSCTL_W} net.ipx.ipx.ipxforwarding=1 > /dev/null
+               ${SYSCTL} net.ipx.ipx.ipxforwarding=1 > /dev/null
        else
-               ${SYSCTL_W} net.ipx.ipx.ipxforwarding=0 > /dev/null
+               ${SYSCTL} net.ipx.ipx.ipxforwarding=0 > /dev/null
        fi
}


Modified: head/etc/rc.d/securelevel
==============================================================================
--- head/etc/rc.d/securelevel   Wed Mar 30 01:10:11 2011        (r220152)
+++ head/etc/rc.d/securelevel   Wed Mar 30 01:19:00 2011        (r220153)
@@ -20,7 +20,7 @@ securelevel_start()
{
        if [ ${kern_securelevel} -ge 0 ]; then
                echo 'Raising kernel security level: '
-               ${SYSCTL_W} kern.securelevel=${kern_securelevel}
+               ${SYSCTL} kern.securelevel=${kern_securelevel}
        fi
}



--
Bjoern A. Zeeb                                 You have to have visions!
         Stop bit received. Insert coin for new address family.
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to