[projects/rc-scripts] - add support for CHECK_LINK_WAIT_TIMEOUT config variable (wait max x sec for interface link up)

adwol adwol at pld-linux.org
Sat Dec 23 13:37:03 CET 2017


commit f71a1391f8819a26e9ace72406402c2bc96c8a9e
Author: Adam Osuchowski <adwol at pld-linux.org>
Date:   Sat Dec 23 13:30:02 2017 +0100

    - add support for CHECK_LINK_WAIT_TIMEOUT config variable (wait max x sec for interface link up)

 lib/ifup                               | 3 ++-
 sysconfig/interfaces/ifcfg-description | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/lib/ifup b/lib/ifup
index b0c03f57..dee4e58b 100755
--- a/lib/ifup
+++ b/lib/ifup
@@ -176,7 +176,8 @@ if [ -n "$BOOTPROTO" -a "$BOOTPROTO" != "none" -a "$BOOTPROTO" != "static" ]; th
 		fi
 		DHCP_ARGS="$DHCP_OPTIONS $DHCP_ARGS"
 
-		if check_link_down ${DEVICE}; then
+		[ -z "$CHECK_LINK_WAIT_TIMEOUT" ] && CHECK_LINK_WAIT_TIMEOUT=5
+		if check_link_down ${DEVICE} $(( $CHECK_LINK_WAIT_TIMEOUT * 2 )); then
 			run_cmd "$(nls 'Determining IP information for %s (%s)' "$DEVICE" "${DHCP_CLIENT##*/}")" /bin/false
 			nls '%s: Check cable/radio on-off switch?' "$DEVICE"
 			exit 1
diff --git a/sysconfig/interfaces/ifcfg-description b/sysconfig/interfaces/ifcfg-description
index 1629ce0d..45d5a704 100644
--- a/sysconfig/interfaces/ifcfg-description
+++ b/sysconfig/interfaces/ifcfg-description
@@ -81,6 +81,8 @@ VLAN_REORDER_HDR=[0|1]	When this is set, the VLAN device will move the
 [ HANDLING=0|1|2|3 ] (0 is default; used ie. in ATM configuration, for
 		      details see ifup script)
 
+[ CHECK_LINK_WAIT_TIMEOUT=<wait max x sec for interface link up> ]
+
 if 	DEVICE=eth*; then
 
 	[ MEDIA={auto|10baseT|10base2|AUI} ]
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/rc-scripts.git/commitdiff/f71a1391f8819a26e9ace72406402c2bc96c8a9e



More information about the pld-cvs-commit mailing list