aboutsummaryrefslogtreecommitdiff
path: root/net/switchdev-poller
diff options
context:
space:
mode:
authorLuiz Angelo Daros de Luca <luizluca@gmail.com>2020-04-29 17:50:03 -0300
committerLuiz Angelo Daros de Luca <luizluca@gmail.com>2020-04-29 17:52:20 -0300
commitca123aed63b9cbadab573fc367a0d4e4022a0a02 (patch)
treec437914a046e8049d9a78cdb7c8c76d2d423945a /net/switchdev-poller
parent36095e4e4c5ec2a180846def89bbd3dd417445a1 (diff)
switchdev-poller: netifd now keep dev down
Since 19.07, netifd will not try to bring a device up after someone brought it down. This way, there is no need to rename the device. It also fixes a rename error on 19.07 when the *_down device was being in use (by netifd?). Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Diffstat (limited to 'net/switchdev-poller')
-rw-r--r--net/switchdev-poller/Makefile2
-rwxr-xr-xnet/switchdev-poller/files/switchdev-poller32
2 files changed, 15 insertions, 19 deletions
diff --git a/net/switchdev-poller/Makefile b/net/switchdev-poller/Makefile
index 9ac4b9f67..3d216e0ba 100644
--- a/net/switchdev-poller/Makefile
+++ b/net/switchdev-poller/Makefile
@@ -7,7 +7,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=switchdev-poller
-PKG_VERSION:=1.0.1
+PKG_VERSION:=1.1.0
PKG_RELEASE:=1
PKG_MAINTAINER:=Luiz Angelo Daros de Luca <luizluca@gmail.com>
PKG_LICENSE:=GPL-2.0-or-later
diff --git a/net/switchdev-poller/files/switchdev-poller b/net/switchdev-poller/files/switchdev-poller
index 1e2f79e25..4d68c4595 100755
--- a/net/switchdev-poller/files/switchdev-poller
+++ b/net/switchdev-poller/files/switchdev-poller
@@ -3,9 +3,9 @@
# https://www.shellcheck.net/wiki/SC2039 -- In POSIX sh, SC2039: In POSIX sh, string replacement is undefined.
# https://www.shellcheck.net/wiki/SC2039 -- In POSIX sh, string indexing is undefined.
# https://www.shellcheck.net/wiki/SC1091 -- Not following: /lib/functions.sh:...
-# Copyright (C) 2018 Luiz Angelo Daros de Luca <luizluca@gmail.com>
+# Copyright (C) 2018-2020 Luiz Angelo Daros de Luca <luizluca@gmail.com>
#
-# Pools switchdev for port changes
+# Pools switch for port changes
#
[ -n "$NICED" ] && NICED=1 exec nice -n 19 "$0" "$@"
@@ -107,11 +107,8 @@ config_foreach each_switch_vlan switch_vlan
cleanup() {
for device2ports in $devices2ports; do
device=${device2ports%=*}
- ip link show dev ${device}_down >/dev/null 2>&1 && {
- echo "Bringing up $device on exit..."
- ip link set dev ${device}_down name ${device}
- ip link set dev ${device} up >/dev/null 2>&1;
- }
+ echo "Bringing up $device on exit..."
+ ip link set dev ${device} up >/dev/null 2>&1;
done
echo "Stopped poller"
exit
@@ -140,19 +137,18 @@ for device2ports in $devices2ports; do
[ $state = up ] && should_be_up=true
done
- if $should_be_up; then
- ip link show dev ${device}_down >/dev/null 2>&1 && {
- echo "Bringing up $device..."
- ip link set dev ${device}_down name ${device}
- ip link set dev ${device} up >/dev/null 2>&1;
- }
+ if ip link show dev ${device} | grep -q "DOWN"; then
+ current_up=false
else
- ip link show dev ${device} >/dev/null 2>&1 && {
- echo "Bringing down $device..."
- ip link set dev ${device} down >/dev/null 2>&1;
- ip link set dev ${device} name ${device}_down
- }
+ current_up=true
+ fi
+ if $should_be_up && ! $current_up; then
+ echo "Bringing up $device..."
+ ip link set dev ${device} up >/dev/null 2>&1;
+ elif ! $should_be_up && $current_up; then
+ echo "Bringing down $device..."
+ ip link set dev ${device} down >/dev/null 2>&1;
fi
done )
sleep 3