Module Name: src Committed By: christos Date: Sat Apr 20 18:24:18 UTC 2013
Modified Files: src/etc/rc.d: network Log Message: don't attempt to create interfaces that exist and don't hide errors. To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/etc/rc.d/network Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/etc/rc.d/network diff -u src/etc/rc.d/network:1.62 src/etc/rc.d/network:1.63 --- src/etc/rc.d/network:1.62 Fri Nov 2 04:36:13 2012 +++ src/etc/rc.d/network Sat Apr 20 14:24:18 2013 @@ -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 @@ stop_cmd="network_stop" 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 @@ network_start() # 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 @@ network_start() # 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