diff -uNr net-scripts-0.3-zcip/sysconfig/network-scripts/ifup net-scripts-0.3/sysconfig/network-scripts/ifup --- net-scripts-0.3-zcip/sysconfig/network-scripts/ifup 2004-02-13 18:11:48 +0200 +++ net-scripts-0.3/sysconfig/network-scripts/ifup 2004-02-13 18:13:30 +0200 @@ -128,10 +128,33 @@ is_yes "$RECEIVEONLY" && RFLAG="-r" ifconfig "$DEVICE" down - echo "Enslaving $DEVICE to $MASTER" - "$IFENSLAVE" $RFLAG "$MASTER" "$DEVICE" + ifconfig $MASTER up + + # Check, if master needs additional configuration. It is required + # if it should be configured via DHCP but has no slaves yet. + if fakeMAC "$MASTER" && ! ifconfig $MASTER | fgrep -q "inet addr" + then + masterconf=yes + fi - exit 0 + echo "Enslaving $DEVICE to $MASTER" + if "$IFENSLAVE" $RFLAG "$MASTER" "$DEVICE"; then + # Remove unneeded routes + /sbin/route | awk "/$DEVICE\\$/ { print \\$1,\\$3 }" | + while read net mask; do + /sbin/route del -net $net netmask $mask dev $DEVICE + done + fi + + # If additional configuration of master is required, + # continue with master configuration, assuming + # configuration protocol dhcp, else exit + if [ -n "$masterconf" ]; then + DEVICE=$MASTER + DYNCONFIG=true + else + exit 0 + fi fi # Now, run the specific script for Wireless LAN interfaces diff -uNr net-scripts-0.3-zcip/sysconfig/network-scripts/network-functions net-scripts-0.3/sysconfig/network-scripts/network-functions --- net-scripts-0.3-zcip/sysconfig/network-scripts/network-functions 2003-05-20 15:46:06 +0300 +++ net-scripts-0.3/sysconfig/network-scripts/network-functions 2004-02-13 18:13:30 +0200 @@ -109,3 +109,9 @@ fi fi } + +# This function reports if given device has fake (zero only) MAC address +fakeMAC() { + test -z `ifconfig $1 | grep HWaddr | awk '{print $NF}' | tr -d ':0'` +} +