sqm-scripts: backport "make run.sh ignore spurious incomplete hotplug ifups" 918/head
authorHannu Nyman <hannu.nyman@iki.fi>
Thu, 5 Mar 2015 15:57:48 +0000 (17:57 +0200)
committerHannu Nyman <hannu.nyman@iki.fi>
Thu, 5 Mar 2015 15:57:48 +0000 (17:57 +0200)
Backport from trunk the commit improving hotplug action.
https://github.com/openwrt/packages/commit/1b5afe8f464bae8fa38317548ec95fe303334c0d

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
net/sqm-scripts/Makefile
net/sqm-scripts/files/etc/hotplug.d/iface/11-sqm [changed mode: 0644->0755]
net/sqm-scripts/files/usr/lib/sqm/run.sh

index 25c964bad9b34f0ce5e37b7ae1123dfe9371020a..79112227dec38adaf903e3dccc26a49fd33e8c10 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=sqm-scripts
 PKG_VERSION:=8
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_LICENSE:=GPLv2
 
 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
old mode 100644 (file)
new mode 100755 (executable)
index 9543acd..9979602
@@ -1,7 +1,3 @@
 #!/bin/sh
 
-# teach SQM to re-enable itself when an interface re-appears
-logger -t SQM -s "hotplug on interface: ${DEVICE} action: ${ACTION}"
-
 [ "$ACTION" = ifup ] && /usr/lib/sqm/run.sh interface ${DEVICE}
-
index 8995213d76a17d9bb4e8b57cfc6e714ab01f353a..968292bcd37061edfa0cf8e593e7b7ac53f16224 100755 (executable)
@@ -23,7 +23,7 @@ case ${1} in
         ;;
     interface)
        START_ON_IF=$2  # only process this interface
-       logger -t SQM -s "Re/starting sqm on interface ${START_ON_IF}"
+       logger -t SQM -s "Trying to re-start SQM on interface ${START_ON_IF}"
        # TODO if $2 is empty just bail...
        if [ -z ${START_ON_IF} ] ;
        then
@@ -108,6 +108,14 @@ run_simple_qos() {
             logger -t SQM -s "${0} SQM qdiscs on ${IFACE} removed"
             return 0
        fi
+       # in case of spurious hotplug events, try double check whether the interface is really up
+       if [ ! -d /sys/class/net/${IFACE} ] ;
+       then
+           echo "${IFACE} does currently not exist, not even trying to start SQM on nothing." > /dev/kmsg
+           logger -t SQM -s "${IFACE} does currently not exist, not even trying to start SQM on nothing."
+           return 0
+       fi
+
        logger -t SQM -s "${0} Queue Setup Script: ${SCRIPT}"
        [ -x "$SCRIPT" ] && { $SCRIPT ; touch ${ACTIVE_STATE_FILE_FQN}; }
 }