Make use of the params variables limit listing filter setup

Signed-off-by: Jesper Dangaard Brouer <netoptimizer@brouer.com>
This commit is contained in:
Jesper Dangaard Brouer
2020-11-08 13:03:49 +01:00
parent 35ffcec7c3
commit 72d3bba6d9
2 changed files with 18 additions and 9 deletions

View File

@@ -53,5 +53,9 @@ function tc_egress_list()
tc_init_clsact $DEV tc_init_clsact $DEV
tc_egress_bpf_attach $DEV $BPF_OBJ tc_egress_bpf_attach $DEV $BPF_OBJ
info "Listing egress filter on device" # Practical to list egress filters after setup.
tc_egress_list $DEV # (It's a common mistake to have several progs loaded)
if [[ -n $LIST ]]; then
info "Listing egress filter on device"
tc_egress_list $DEV
fi

View File

@@ -8,17 +8,18 @@
function usage() { function usage() {
echo "" echo ""
echo "Usage: $0 [-vfh] --dev ethX" echo "Usage: $0 [-vfh] --dev ethX"
echo " -d | --dev : (\$DEV) Ingress interface/device (required)" echo " -d | --dev : (\$DEV) Ingress interface/device (required)"
echo " -v | --verbose : (\$VERBOSE) verbose" echo " -v | --verbose : (\$VERBOSE) verbose"
echo " --flush : (\$FLUSH) Only flush (remove TC drop rules)" echo " --flush : (\$FLUSH) Only flush (remove TC drop rules)"
echo " --dry-run : (\$DRYRUN) Dry-run only (echo tc commands)" echo " --dry-run : (\$DRYRUN) Dry-run only (echo tc commands)"
echo " -s | --stats : (\$STATS) Call TC statistics command" echo " -s | --stats : (\$STATS_ONLY) Call TC statistics command"
echo " -l | --list : (\$LIST) List TC filter setup after setup"
echo "" echo ""
} }
# Using external program "getopt" to get --long-options # Using external program "getopt" to get --long-options
OPTIONS=$(getopt -o vfshd: \ OPTIONS=$(getopt -o vfshd:l \
--long verbose,dry-run,flush,stats,help,dev: -- "$@") --long verbose,dry-run,flush,stats,list,help,dev: -- "$@")
if (( $? != 0 )); then if (( $? != 0 )); then
usage usage
err 2 "Error calling getopt" err 2 "Error calling getopt"
@@ -52,6 +53,10 @@ while true; do
export STATS_ONLY=yes export STATS_ONLY=yes
shift shift
;; ;;
-l | --list )
export LIST=yes
shift
;;
-- ) -- )
shift shift
break break