Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

samples/bpf: Fix tc and ip paths in xdp2skb_meta.sh

The below path error can occur:

# ./xdp2skb_meta.sh --dev eth0 --list
./xdp2skb_meta.sh: line 61: /usr/sbin/tc: No such file or directory

So just use command names instead of absolute paths of tc and ip.
In addition, it allow callers to redefine $TC and $IP paths

Fixes: 36e04a2d78d9 ("samples/bpf: xdp2skb_meta shows transferring info from XDP to SKB")
Reviewed-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>

authored by

Taeung Song and committed by
Daniel Borkmann
b9626f45 f292b87d

+3 -3
+3 -3
samples/bpf/xdp2skb_meta.sh
··· 16 16 BPF_FILE=xdp2skb_meta_kern.o 17 17 DIR=$(dirname $0) 18 18 19 - export TC=/usr/sbin/tc 20 - export IP=/usr/sbin/ip 19 + [ -z "$TC" ] && TC=tc 20 + [ -z "$IP" ] && IP=ip 21 21 22 22 function usage() { 23 23 echo "" ··· 53 53 local allow_fail="$2" 54 54 shift 2 55 55 if [[ -n "$VERBOSE" ]]; then 56 - echo "$(basename $cmd) $@" 56 + echo "$cmd $@" 57 57 fi 58 58 if [[ -n "$DRYRUN" ]]; then 59 59 return