Skip to content

Commit

Permalink
defaults.sh: Don't override INSMOD variable if it is already set
Browse files Browse the repository at this point in the history
@SpareSimian noticed that sqm-scripts would always use 'insmod' to load
modules on CentOS even though modprobe was also available. @gordonmessmer
noticed that this was due to the way the shell chains '&&' and '||'
operators, which would evaluate the second assignment if the first
zero-length check fails. And since defaults.sh is included from both
'start-sqm' and the .qos scripts, this double-evaluation always happens on
non-OpenWrt installations.

Fix this by properly grouping the assignment operators so they are
evaluated together if the variable is unset.

Fixes #133.

Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
  • Loading branch information
tohojo committed Feb 28, 2021
1 parent 195d3b5 commit 5d7e797
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/defaults.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@


# Try modprobe first, fall back to insmod
[ -z "$INSMOD" ] && INSMOD=$(which modprobe) || INSMOD=$(which insmod)
[ -z "$INSMOD" ] && { INSMOD=$(which modprobe) || INSMOD=$(which insmod); }
[ -z "$TARGET" ] && TARGET="5ms"
[ -z "$IPT_MASK" ] && IPT_MASK="0xff" # to disable: set mask to 0xffffffff
#sm: we need the functions above before trying to set the ingress IFB device
Expand Down

0 comments on commit 5d7e797

Please sign in to comment.