Browse Source

Allow luci-app-sqm to define debug logging per interface/sqm-instance

This commit will interpret the "Create log file for this SQM" checkbox
state from luci-app-sqm on a per interface way. It will also allow to override
the per instance setting from the GUI via e.g.:
/etc/init.d/sqm stop ; SQM_DEBUG=1 /etc/init.d/sqm start ; SQM_DEBUG=1 /etc/init.d/sqm stop ; SQM_DEBUG=0 /etc/init.d/sqm start
This will effectively activate debug logging for all intrefaces.
The log files will appear under /var/run/sqm/${IFACE}.debug.log
They will contain the invocation and output of all calls to ip,
iptables, ip6tables, tc, and all sqm_logger calls acive for the given
value of SQM_VERBOSITY (this commit also introduces SQM_VERBOSITY, even
though there are no users yet, as preparation for pruning sqm output to
be less verbose by default).

Signed-off-by: Sebastian Moeller <moeller0@gmx.de>
Sebastian Moeller 8 years ago
parent
commit
25a5e6c701
2 changed files with 3 additions and 1 deletions
  1. 1 0
      src/defaults.sh
  2. 2 1
      src/run-openwrt.sh

+ 1 - 0
src/defaults.sh

@@ -38,6 +38,7 @@
 [ -z "$EGRESS_CAKE_OPTS" ] && EGRESS_CAKE_OPTS="diffserv4"
 
 #sm: allow more verbose logging?
+[ -z "$SQM_VERBOSITY" ] && SQM_VERBOSITY=1	#0: none, 1: normal, 2: verbose, 11: too much
 [ -z "$SQM_DEBUG" ] && SQM_DEBUG=0
 if [ "$SQM_DEBUG" == 1 ] 
 then

+ 2 - 1
src/run-openwrt.sh

@@ -55,13 +55,14 @@ run_sqm_scripts() {
     export TARGET=$(config_get "$section" target)
     export SQUASH_DSCP=$(config_get "$section" squash_dscp)
     export SQUASH_INGRESS=$(config_get "$section" squash_ingress)
+    export SQM_VERBOSITY=$(config_get "$section" verbosity)
 
     export QDISC=$(config_get "$section" qdisc)
     export SCRIPT=$(config_get "$section" script)
 
 
     #sm: if SQM_DEBUG was passed in via the command line make it available to the other scripts
-    [ -z "$SQM_DEBUG" ] && export SQM_DEBUG
+    [ -n "$SQM_DEBUG" ] && export SQM_DEBUG || export SQM_DEBUG=$(config_get "$section" debug_logging)
 
     #sm: only stop-sqm if there is something running
     CUR_STATE_FILE="${SQM_STATE_DIR}/${IFACE}.state"