integ/base/initscripts/centos/patches/sysconfig-unsafe-usage-of-linkdelay-variable.patch
slin14 45ecc7f61f rebase initscripts patch to CentOS7.5
Story: 2003389
Task: 24475

Change-Id: I9127f8235d1bf437d11363fb6af785473f829aae
Signed-off-by: slin14 <shuicheng.lin@intel.com>
2018-08-22 14:59:32 +08:00

34 lines
1.2 KiB
Diff

From 9b12287d8dade60c012969db3ae56b36d1e50966 Mon Sep 17 00:00:00 2001
From: Allain Legacy <allain.legacy@windriver.com>
Date: Thu, 17 Nov 2016 11:37:38 -0500
Subject: [PATCH] sysconfig: unsafe usage of linkdelay variable
If the LINKDELAY variable is an alphabetic string instead of an integer then
the calculation in check_link_down() causes delay to be set to 0. That causes
the loop to never execute and for the caller to think that the link is always
down.
This does not address but is related to CGTS-5821
Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
---
sysconfig/network-scripts/network-functions | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index 13cf4de..4bcc48f 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -471,7 +471,7 @@ check_link_down ()
fi
timeout=0
delay=20
- [ -n "$LINKDELAY" ] && delay=$(($LINKDELAY * 2))
+ [[ $LINKDELAY =~ ^[0-9]+$ ]] && delay=$(($LINKDELAY * 2))
while [ $timeout -le $delay ]; do
[ "$(cat /sys/class/net/$REALDEVICE/carrier 2>/dev/null)" == "1" ] && return 1
sleep 0.5
--
2.7.4