Subject: Re: /sbin/ifup
To: Johan Danielsson <joda@pdc.kth.se>
From: Michael Richardson <mcr@sandelman.ottawa.on.ca>
List: tech-net
Date: 07/29/2003 21:18:41
-----BEGIN PGP SIGNED MESSAGE-----


>>>>> "Johan" == Johan Danielsson <joda@pdc.kth.se> writes:
    >> I'd like to commit this. Comments?

    Johan> If this is useful, I think the right way is to split rc.d/network
    Johan> into 
    Johan> something that just configures interfaces.

  I'm not sure what you mean precisely.

  What I did was:

istari-[/usr/src/sbin/ifup] mcr 1044 %cat ifup.sh
#! /bin/sh

#
# $NetBSD$
#

. /etc/rc.subr
. /etc/rc.conf

for int 
do
  eval args=\$ifconfig_$int
  if [ -n "$args" ] || [ -f /etc/ifconfig.$int ]; then
        if ifconfig $int create 2>/dev/null && \
           checkyesno ipfilter; then
           # resync ipf(4)
           ipf -y >/dev/null
        fi
  fi
  if [ -n "$args" ]; then
        ifconfig $int $args
  elif [ -f /etc/ifconfig.$int ]; then
        echo -n " $int"
        while read args; do
        [ -z "$args" ] && continue
        case "$args" in
        "#"*)
                ;;
                "!"*)
                        eval ${args#*!}
                        ;;
                *)
                        ifconfig $int $args
                        ;;
                esac
        done < /etc/ifconfig.$int
  else
        if ! checkyesno auto_ifconfig; then
                echo
                warn \
"/etc/ifconfig.$int missing and ifconfig_$int not set;"
                warn "interface $int not configured."
        fi
        continue
  fi
done

# final newline
echo ''

====

istari-[/usr/src/etc/rc.d] mcr 1040 %cvs diff -u network
Index: network
===================================================================
RCS file: /cvsroot/src/etc/rc.d/network,v
retrieving revision 1.38.2.1
diff -u -r1.38.2.1 network
- --- network     2002/10/23 12:34:40     1.38.2.1
+++ network     2003/07/30 01:17:28
@@ -183,44 +183,8 @@
                        tmp="$net_interfaces"
                fi
                echo -n 'Configuring network interfaces:'
- -               for int in $tmp; do
- -                       eval args=\$ifconfig_$int
- -                       if [ -n "$args" ] || [ -f /etc/ifconfig.$int ]; then
- -                               if ifconfig $int create 2>/dev/null && \
- -                                  checkyesno ipfilter; then
- -                                       # resync ipf(4)
- -                                       ipf -y >/dev/null
- -                               fi
- -                       fi
- -                       if [ -n "$args" ]; then
- -                               echo -n " $int"
- -                               ifconfig $int $args
- -                       elif [ -f /etc/ifconfig.$int ]; then
- -                               echo -n " $int"
- -                               while read args; do
- -                                       [ -z "$args" ] && continue
- -                                       case "$args" in
- -                                       "#"*|create)
- -                                               ;;
- -                                       "!"*)
- -                                               eval ${args#*!}
- -                                               ;;
- -                                       *)
- -                                               ifconfig $int $args
- -                                               ;;
- -                                       esac
- -                               done < /etc/ifconfig.$int
- -                       else
- -                               if ! checkyesno auto_ifconfig; then
- -                                       echo
- -                                       warn \
- -                       "/etc/ifconfig.$int missing and ifconfig_$int not set;"
- -                                       warn "interface $int not configured."
- -                               fi
- -                               continue
- -                       fi
- -                       configured_interfaces="$configured_interfaces $int"
- -               done
+               configured_interfaces=`/sbin/ifup $tmp`
+               echo -n $configured_interfaces
                echo "."
        fi
 
zsh: 8284 exit 1     cvs diff -u network
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: Finger me for keys - custom hacks make this fully PGP2 compat

iQCVAwUBPycc8IqHRg3pndX9AQEy9wP+OvZsS/9DjoYtGO3Aj7DWWtSt2XhyPZ4X
oxBpatltYOlP2VWZpvWVDQ+TR/gM0N8I3jXHlL9geSIdQEe+P69WEtqTxFxJJX/v
QpvIQNT2X+PSGFMSjTFjmuM94alr+dNfxpd6JzRjDmZ1ApIqYX8EQGU4J4IjJjzf
W/OAY0P5UOc=
=bCxG
-----END PGP SIGNATURE-----