summaryrefslogtreecommitdiffstats
path: root/samples
diff options
context:
space:
mode:
authorIoana Ciornei <ioana.ciornei@nxp.com>2019-01-09 18:06:55 +0100
committerDaniel Borkmann <daniel@iogearbox.net>2019-01-10 15:54:47 +0100
commit11b36abc249f5e100d532c5271dae938fde85175 (patch)
treea10da71432c66ad95d7a8f05bffe41ad5d6a0361 /samples
parentselftests/bpf: add missing executables to .gitignore (diff)
downloadlinux-11b36abc249f5e100d532c5271dae938fde85175.tar.xz
linux-11b36abc249f5e100d532c5271dae938fde85175.zip
samples: bpf: user proper argument index
Use optind as index for argv instead of a hardcoded value. When the program has options this leads to improper parameter handling. Fixes: dc378a1ab5b6 ("samples: bpf: get ifindex from ifname") Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> Acked-by: Matteo Croce <mcroce@redhat.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'samples')
-rw-r--r--samples/bpf/xdp1_user.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/samples/bpf/xdp1_user.c b/samples/bpf/xdp1_user.c
index 0a197f86ac43..8bfda95c77ad 100644
--- a/samples/bpf/xdp1_user.c
+++ b/samples/bpf/xdp1_user.c
@@ -103,7 +103,7 @@ int main(int argc, char **argv)
return 1;
}
- ifindex = if_nametoindex(argv[1]);
+ ifindex = if_nametoindex(argv[optind]);
if (!ifindex) {
perror("if_nametoindex");
return 1;