aboutsummaryrefslogtreecommitdiffstats
path: root/network-scripts/network-functions
diff options
context:
space:
mode:
authorJan Macku <jamacku@redhat.com>2020-12-15 10:07:50 +0100
committerGitHub <noreply@github.com>2020-12-15 10:07:50 +0100
commite0c58b190523421347021029cd4516c7fc5db0bc (patch)
tree7db22e00645da1958f391af60c91ab2324b3cd3f /network-scripts/network-functions
parent748122158d6b7007a49b38a78f22a749f1d2786d (diff)
downloadinitscripts-e0c58b190523421347021029cd4516c7fc5db0bc.tar
initscripts-e0c58b190523421347021029cd4516c7fc5db0bc.tar.gz
initscripts-e0c58b190523421347021029cd4516c7fc5db0bc.tar.bz2
initscripts-e0c58b190523421347021029cd4516c7fc5db0bc.tar.xz
initscripts-e0c58b190523421347021029cd4516c7fc5db0bc.zip
network: add option to keep the link down
Some interfaces like Open vSwitch bridges using the userspace datapath, needs the link to be kept down to avoid issues. Add a LINKSTATUS=[down|up] ifcfg parameter to add this functionality. If not specified, the link will default to up as before. Patch provided by Matteo Croce mcroce@redhat.com Resolves: #1555001
Diffstat (limited to 'network-scripts/network-functions')
-rw-r--r--network-scripts/network-functions11
1 files changed, 9 insertions, 2 deletions
diff --git a/network-scripts/network-functions b/network-scripts/network-functions
index 614ad2ca..5f6c72d4 100644
--- a/network-scripts/network-functions
+++ b/network-scripts/network-functions
@@ -453,11 +453,18 @@ check_device_down ()
fi
}
-check_link_down ()
+set_link_up ()
{
- if ! LC_ALL=C ip link show dev $1 2>/dev/null| grep -q ",UP" ; then
+ if [ "$LINKSTATUS" = down ]; then
ip link set dev $1 up >/dev/null 2>&1
+ else
+ grep -qsx 1 /sys/class/net/$1/carrier
fi
+}
+
+check_link_down ()
+{
+ set_link_up $1
timeout=0
delay=10
[ -n "$LINKDELAY" ] && delay=$(($LINKDELAY * 2))