Browse Source

sqm-scripts: make run.sh ignore spurious incomplete hotplug ifups

During system start up pppoe devices seem to receice ifup events before
the interface actually exists. This commit makes sqm's run.sh script
test whether the sys files for an interface exist before actually trying
to start an SQM instance on an interface. This seems to nicely avoid
starting on an not fully established pppoe interface and avoids a number
of error messages during startup.

In addition, debug logging is disabled.

Signed-off-by: Sebastian Moeller <moeller0@gmx.de>
Sebastian Moeller 10 years ago
parent
commit
1b5afe8f46

+ 1
- 1
net/sqm-scripts/Makefile View File

@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
9 9
 
10 10
 PKG_NAME:=sqm-scripts
11 11
 PKG_VERSION:=8
12
-PKG_RELEASE:=1
12
+PKG_RELEASE:=2
13 13
 PKG_LICENSE:=GPLv2
14 14
 
15 15
 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

+ 0
- 4
net/sqm-scripts/files/etc/hotplug.d/iface/11-sqm View File

@@ -1,7 +1,3 @@
1 1
 #!/bin/sh
2 2
 
3
-# teach SQM to re-enable itself when an interface re-appears
4
-logger -t SQM -s "hotplug on interface: ${DEVICE} action: ${ACTION}"
5
-
6 3
 [ "$ACTION" = ifup ] && /usr/lib/sqm/run.sh interface ${DEVICE}
7
-

+ 9
- 1
net/sqm-scripts/files/usr/lib/sqm/run.sh View File

@@ -23,7 +23,7 @@ case ${1} in
23 23
         ;;
24 24
     interface)
25 25
 	START_ON_IF=$2	# only process this interface
26
-	logger -t SQM -s "Re/starting sqm on interface ${START_ON_IF}"
26
+	logger -t SQM -s "Trying to re-start SQM on interface ${START_ON_IF}"
27 27
 	# TODO if $2 is empty just bail...
28 28
 	if [ -z ${START_ON_IF} ] ;
29 29
 	then
@@ -108,6 +108,14 @@ run_simple_qos() {
108 108
 	     logger -t SQM -s "${0} SQM qdiscs on ${IFACE} removed"
109 109
 	     return 0
110 110
 	fi
111
+	# in case of spurious hotplug events, try double check whether the interface is really up
112
+	if [ ! -d /sys/class/net/${IFACE} ] ;
113
+	then
114
+	    echo "${IFACE} does currently not exist, not even trying to start SQM on nothing." > /dev/kmsg
115
+	    logger -t SQM -s "${IFACE} does currently not exist, not even trying to start SQM on nothing."
116
+	    return 0
117
+	fi
118
+
111 119
 	logger -t SQM -s "${0} Queue Setup Script: ${SCRIPT}"
112 120
 	[ -x "$SCRIPT" ] && { $SCRIPT ; touch ${ACTIVE_STATE_FILE_FQN}; }
113 121
 }