Skip to content

Commit

Permalink
Fix stop.sh to avoid creating spurious ifb4ge00 interfaces
Browse files Browse the repository at this point in the history
stop.sh was sourcing functions.sh without IFACE being created.
In that case functions.sh was defaulting to ge00, since stop.sh was
changed to take the interface name in its first argument instead
of as an environmet variable, a spurious ifb4ge00 was created, but only
deleted if ge00 was the passed interface. For openwrt with its
ethN.N interface names that resulted in ifb4ge00 being created but
never deleted. While this probably did not cause any malfunction
it still was confusing. Hopefully it is fixed now.
  • Loading branch information
moeller0 committed Oct 18, 2014
1 parent fb3426f commit 371b653
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions net/sqm-scripts/files/usr/lib/sqm/stop.sh
Expand Up @@ -6,11 +6,12 @@
#
# Copyright (C) 2012-4 Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller

. /usr/lib/sqm/functions.sh

# allow passing in the IFACE as first command line argument
[ ! -z ${1} ] && IFACE=${1}
sqm_logger "${0} Stopping ${IFACE}"
# now IFACE is defined so we can source functions.sh without creating a spurious ifb4ge00
. /usr/lib/sqm/functions.sh
# sqm_logger is defined in functions.sh...
sqm_logger "${0}: Stopping ${IFACE}"

# make sure to only delete the ifb associated with the current interface
CUR_IFB=$( get_ifb_associated_with_if ${IFACE} )
Expand All @@ -19,7 +20,7 @@ sqm_stop() {
tc qdisc del dev $IFACE ingress 2> /dev/null
tc qdisc del dev $IFACE root 2> /dev/null
[ ! -z "$CUR_IFB" ] && tc qdisc del dev $CUR_IFB root 2> /dev/null
[ ! -z "$CUR_IFB" ] && sqm_logger "${CUR_IFB} shaper deleted"
[ ! -z "$CUR_IFB" ] && sqm_logger "${0}: ${CUR_IFB} shaper deleted"
}

ipt_stop() {
Expand All @@ -36,6 +37,6 @@ sqm_stop
ipt_stop
[ ! -z "$CUR_IFB" ] && ifconfig ${CUR_IFB} down
[ ! -z "$CUR_IFB" ] && ip link delete ${CUR_IFB} type ifb
[ ! -z "$CUR_IFB" ] && sqm_logger "${CUR_IFB} interface deleted"
[ ! -z "$CUR_IFB" ] && sqm_logger "${0}: ${CUR_IFB} interface deleted"

exit 0

0 comments on commit 371b653

Please sign in to comment.