Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/etc/rc.d don't attempt to create interfaces that exist and d...



details:   https://anonhg.NetBSD.org/src/rev/907c0728fdc4
branches:  trunk
changeset: 786233:907c0728fdc4
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Apr 20 18:24:18 2013 +0000

description:
don't attempt to create interfaces that exist and don't hide errors.

diffstat:

 etc/rc.d/network |  27 +++++++++++++++++++++------
 1 files changed, 21 insertions(+), 6 deletions(-)

diffs (58 lines):

diff -r cc07456e331f -r 907c0728fdc4 etc/rc.d/network
--- a/etc/rc.d/network  Sat Apr 20 18:04:41 2013 +0000
+++ b/etc/rc.d/network  Sat Apr 20 18:24:18 2013 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: network,v 1.62 2012/11/02 08:36:13 yamt Exp $
+# $NetBSD: network,v 1.63 2013/04/20 18:24:18 christos Exp $
 #
 
 # PROVIDE: network
@@ -16,6 +16,18 @@
 nl='
 ' # a newline
 
+intmissing() {
+       local int="$1"
+       shift
+       for i
+       do
+               if [ "$int" = "$i" ]; then
+                       return 1
+               fi
+       done
+       return 0
+}
+
 network_start()
 {
        # set hostname, turn on network
@@ -190,9 +202,10 @@
        # starting a line with "!".  Refer to ifconfig.if(5) for details.
        #
        if [ "$net_interfaces" != NO ]; then
+               ifaces="$(/sbin/ifconfig -l)"
                if checkyesno auto_ifconfig; then
-                       tmp=$(/sbin/ifconfig -l)
-                       for cloner in $(/sbin/ifconfig -C 2>/dev/null); do
+                       tmp="$ifaces"
+                       for cloner in $(/sbin/ifconfig -C); do
                                for int in /etc/ifconfig.${cloner}[0-9]*; do
                                        [ ! -f $int ] && break
                                        tmp="$tmp ${int##*.}"
@@ -226,9 +239,11 @@
                        # If the interface did not exist before,
                        # then also resync ipf(4).
                        #
-                       if /sbin/ifconfig $int create 2>/dev/null && \
-                          checkyesno ipfilter; then
-                               /sbin/ipf -y >/dev/null
+                       if intmissing $int $ifaces; then
+                               if /sbin/ifconfig $int create && \
+                                  checkyesno ipfilter; then
+                                       /sbin/ipf -y >/dev/null
+                               fi
                        fi
 
                        # If $ifconfig_xxN is empty, then use



Home | Main Index | Thread Index | Old Index