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