From: Serge L. <sma...@us...> - 2010-03-24 04:54:25
|
Update of /cvsroot/devil-linux/build/config/etc/init.d In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv21871 Modified Files: network Log Message: - readded support for aliases and secondary IP Index: network =================================================================== RCS file: /cvsroot/devil-linux/build/config/etc/init.d/network,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- network 31 Jan 2010 15:38:07 -0000 1.43 +++ network 24 Mar 2010 04:54:14 -0000 1.44 @@ -216,7 +216,14 @@ if [ -n "$IP" ]; then # configure IPv4 address echo -n " [IPv4]" - ip addr add $IP$NMASK $BCAST dev $DEVICE; let ret=$ret+$? + # check if it's an alias + if echo $DEVICE | grep ':' > /dev/null ; then + LABEL=$DEVICE + DEVICE=$(echo $LABEL | cut -d':' -f1) + ip addr add $IP$NMASK $BCAST dev $DEVICE label $LABEL; let ret=$ret+$? + else + ip addr add $IP$NMASK $BCAST dev $DEVICE ; let ret=$ret+$? + fi fi if [ -n "$IPV6ADDR" ]; then @@ -321,6 +328,21 @@ [ "$DHCP" == yes ] && dhcp_client_stop + echo "Removing ip address from interface $DEVICE" + BCAST=""; test -n "$BROADCAST" && BCAST="broadcast $BROADCAST" + NMASK=""; test -n "$NETMASK" && NMASK="/$NETMASK" + + if [ -n "$IP" ]; then + # configure IPv4 address + # check if it's an alias + if echo $DEVICE | grep ':' > /dev/null ; then + LABEL=$DEVICE + DEVICE=$(echo $LABEL | cut -d':' -f1) + ip addr del $IP$NMASK $BCAST dev $DEVICE label $LABEL + else + ip addr del $IP$NMASK $BCAST dev $DEVICE + fi + fi echo -n "Stopping interface $DEVICE" ip link set $DEVICE down 2>/dev/null evaluate_retval |