mirror of
https://github.com/xdp-project/bpf-examples.git
synced 2024-05-06 15:54:53 +00:00
Make use of the params variables limit listing filter setup
Signed-off-by: Jesper Dangaard Brouer <netoptimizer@brouer.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user