summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Rayner <james@archlinux.org>2009-04-28 14:44:15 +0200
committerJames Rayner <james@archlinux.org>2009-04-28 14:44:15 +0200
commit405a2061e571e5ebdbd5167773fd7ca05fcbbd8c (patch)
treef47690586e58ec49c6f7856df8064674eb26ea1f /src
parent7b31dcd7b6da4f26db8f09924adc059f5a6ee589 (diff)
downloadnetctl-405a2061e571e5ebdbd5167773fd7ca05fcbbd8c.tar.gz
netctl-405a2061e571e5ebdbd5167773fd7ca05fcbbd8c.tar.xz
Fix cable check and handle devices which take some time to report state=up. FS#13334
Diffstat (limited to 'src')
-rw-r--r--src/connections/ethernet19
-rw-r--r--src/connections/ethernet-iproute16
2 files changed, 22 insertions, 13 deletions
diff --git a/src/connections/ethernet b/src/connections/ethernet
index 9ec27fb..a0408e5 100644
--- a/src/connections/ethernet
+++ b/src/connections/ethernet
@@ -11,18 +11,19 @@ ethernet_up() {
fi
fi
- # Connection check
- if ip link show "$INTERFACE"|grep -q "NO-CARRIER"; then
- err_append "no connection available"
- return 1
- fi
+ ip link set $INTERFACE up
- ifconfig "$INTERFACE" up
-
- # Some hardware is not immediately ready after ifconfig up
- while ip link show $INTERFACE|grep -q "state UNKNOWN"; do
+ let timeout=0
+ until ip link show $INTERFACE|grep -q "state UP"
+ do
sleep 0.5
+ let timeout++
+ if [[ $timeout -eq 5 ]]; then
+ err_append "No connection"
+ return 1
+ fi
done
+
if checkyesno "${AUTH8021X:-no}"; then
. "${SUBR_DIR}"/8021x
diff --git a/src/connections/ethernet-iproute b/src/connections/ethernet-iproute
index a960e1d..bb6b152 100644
--- a/src/connections/ethernet-iproute
+++ b/src/connections/ethernet-iproute
@@ -18,11 +18,19 @@ ethernet_up() {
fi
fi
- if ip link show $INTERFACE|grep -q "NO-CARRIER"; then
- error "No connection available"
- fi
+ ip link set $INTERFACE up
+
+ let timeout=0
+ until ip link show $INTERFACE|grep -q "state UP"
+ do
+ sleep 0.5
+ let timeout++
+ if [[ $timeout -eq 5 ]]; then
+ error "No connection"
+ return 1
+ fi
+ done
- ip link set $INTERFACE up
if checkyesno ${AUTH8021X:-no}; then
. ${SUBR_DIR}/8021x