From 405a2061e571e5ebdbd5167773fd7ca05fcbbd8c Mon Sep 17 00:00:00 2001 From: James Rayner Date: Tue, 28 Apr 2009 22:44:15 +1000 Subject: Fix cable check and handle devices which take some time to report state=up. FS#13334 --- src/connections/ethernet | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/connections/ethernet') 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 -- cgit v1.2.3-24-g4f1b