aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-05-29 10:34:58 +0200
committerJo-Philipp Wich <jo@mein.io>2020-05-29 10:37:13 +0200
commitc963e4267b916fa3b074b5ae1f5b5d2b9fc0af68 (patch)
treed8deb19a196211a34bbd85dd87c7c852ce58c5f9 /package
parent31de4a40e758f384e89b592806a64130833cac35 (diff)
downloadupstream-c963e4267b916fa3b074b5ae1f5b5d2b9fc0af68.tar.gz
upstream-c963e4267b916fa3b074b5ae1f5b5d2b9fc0af68.tar.bz2
upstream-c963e4267b916fa3b074b5ae1f5b5d2b9fc0af68.zip
qos-scripts: fix interface resolving
Also ensure that the error message is actually printed to stderr and that the rule generation is aborted if an interface cannot be resolved. Ref: https://github.com/openwrt/luci/issues/3975 Signed-off-by: Jo-Philipp Wich <jo@mein.io> (cherry picked from commit 559b3384666bbc6e4e9e6d86cf54bd88d30b341f)
Diffstat (limited to 'package')
-rw-r--r--package/network/config/qos-scripts/Makefile2
-rwxr-xr-xpackage/network/config/qos-scripts/files/usr/lib/qos/generate.sh20
2 files changed, 14 insertions, 8 deletions
diff --git a/package/network/config/qos-scripts/Makefile b/package/network/config/qos-scripts/Makefile
index abaeaeb981..7d282b2db5 100644
--- a/package/network/config/qos-scripts/Makefile
+++ b/package/network/config/qos-scripts/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=qos-scripts
PKG_VERSION:=1.3.1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
diff --git a/package/network/config/qos-scripts/files/usr/lib/qos/generate.sh b/package/network/config/qos-scripts/files/usr/lib/qos/generate.sh
index 3ec7f80e53..024be0c170 100755
--- a/package/network/config/qos-scripts/files/usr/lib/qos/generate.sh
+++ b/package/network/config/qos-scripts/files/usr/lib/qos/generate.sh
@@ -22,15 +22,20 @@ add_insmod() {
[ -e /etc/config/network ] && {
# only try to parse network config on openwrt
- find_ifname() {(
- reset_cb
- include /lib/network
- scan_interfaces
- config_get "$1" ifname
- )}
+ . /lib/functions/network.sh
+
+ find_ifname() {
+ local ifname
+ if network_get_device ifname "$1"; then
+ echo "$ifname"
+ else
+ echo "Device for interface $1 not found." >&2
+ exit 1
+ fi
+ }
} || {
find_ifname() {
- echo "Interface not found."
+ echo "Interface not found." >&2
exit 1
}
}
@@ -218,6 +223,7 @@ qos_parse_config() {
config_get device "$1" device
[ -z "$device" ] && {
device="$(find_ifname $1)"
+ [ -z "$device" ] && exit 1
config_set "$1" device "$device"
}
}