diff options
author | Jouke Witteveen <j.witteveen@gmail.com> | 2012-06-21 12:19:53 +0200 |
---|---|---|
committer | Jouke Witteveen <j.witteveen@gmail.com> | 2012-06-21 12:19:53 +0200 |
commit | 5ac724b8d139b7e38c3a16c8752bad55076ea670 (patch) | |
tree | b7d5cdb68c5e050829aa6de401224284c0b482c0 /src/connections/ethernet | |
parent | 4e034777fa0bfffa11d87b602e6b2b941edd3262 (diff) | |
download | netctl-5ac724b8d139b7e38c3a16c8752bad55076ea670.tar.gz netctl-5ac724b8d139b7e38c3a16c8752bad55076ea670.tar.xz |
Introduce polling timeout logic
This should fix FS#30361 along the way.
Diffstat (limited to 'src/connections/ethernet')
-rw-r--r-- | src/connections/ethernet | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/connections/ethernet b/src/connections/ethernet index e51f68d..24e92d5 100644 --- a/src/connections/ethernet +++ b/src/connections/ethernet @@ -14,8 +14,6 @@ report_iproute() } ethernet_up() { - local dad_timeout="${DAD_TIMEOUT:-3}" - load_profile "$1" SYSCTL_INTERFACE="${INTERFACE/.//}" @@ -34,10 +32,9 @@ ethernet_up() { bring_interface up "$INTERFACE" - if ! checkyesno "${SKIPNOCARRIER:-no}" && ip link show dev "$INTERFACE" | fgrep -q "NO-CARRIER"; then + if ! checkyesno "${SKIPNOCARRIER:-no}"; then # Some cards are plain slow to come up. Don't fail immediately. - sleep ${CARRIER_TIMEOUT:-2} - if ip link show dev "$INTERFACE" | fgrep -q "NO-CARRIER"; then + if ! timeout_wait "${CARRIER_TIMEOUT:-5}" '! ip link show dev "$INTERFACE" | fgrep -q "NO-CARRIER"'; then report_iproute "No connection" fi fi @@ -186,12 +183,9 @@ ethernet_up() { if [[ -n "$IP6" ]]; then # Wait for DAD to finish (FS#28887) report_debug ethernet_up ip -6 addr show dev "$INTERFACE" tentative - while [[ -n "$(ip -6 addr show dev "$INTERFACE" tentative)" ]]; do - if (( dad_timeout-- <= 0 )); then - report_iproute "Duplicate Address Detection is taking too long" - fi - sleep 1 - done + if ! timeout_wait "${DAD_TIMEOUT:-3}" '[[ -z "$(ip -6 addr show dev "$INTERFACE" tentative)" ]]'; then + report_iproute "Duplicate Address Detection is taking too long" + fi # Add static IPv6 routes if [[ -n "$ROUTES6" ]]; then |