Fixed hardware.sh to test for link with ethtool
root [Sat, 7 Aug 2010 00:19:37 +0000 (19:19 -0500)]
etc/hardware.sh

index c5dfac2..862e8b9 100755 (executable)
@@ -30,8 +30,8 @@ dhcp_on_interface() {
                return 1
        fi
 
+
        # work around Cisco portfast implementation not being fast
-       /bin/ip link set dev ${i} up
 
        if [ "${spantree}" != "" ]
        then
@@ -41,7 +41,7 @@ dhcp_on_interface() {
 
        msg -n "Trying DHCP on ${i} interface"
 
-       /sbin/udhcpc -i ${INTERFACE} -n -s /etc/ifup.udhcp.sh \
+       /sbin/udhcpc -i ${INTERFACE} -T 5 -n -s /etc/ifup.udhcp.sh \
                -p /tmp/dhcp.${INTERFACE}.pid >> /tmp/stdout.log 2>> /tmp/stderr.log
 
        if [ "$?" = 0 ]
@@ -81,10 +81,16 @@ do
 
        NET_DEVICE_COUNT=`expr ${NET_DEVICE_COUNT} + 1`
 
+       /bin/ip link set dev ${i} up
+       /sbin/ifconfig ${i} up
+
+       msg "Sleeping for 15 seconds for link to come up on ${i}"
+       sleep 15
+
        msg -n "Checking link status for ${i}"
-       /bin/mii-diag -s ${i} >> /tmp/stdout.log 2>> /tmp/stderr.log
+       LINK=`/usr/bin/ethtool ${i} | grep Link | awk '{print $3}' 2> /dev/null`
 
-       if [ "$?" != "0" ];
+       if [ "${LINK}" != "yes" ];
        then
                fail_msg
        else