Commit 11b36abc authored by Ioana Ciornei's avatar Ioana Ciornei Committed by Daniel Borkmann

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: dc378a1a ("samples: bpf: get ifindex from ifname")
Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
Acked-by: default avatarMatteo Croce <mcroce@redhat.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent e3ca63de
...@@ -103,7 +103,7 @@ int main(int argc, char **argv) ...@@ -103,7 +103,7 @@ int main(int argc, char **argv)
return 1; return 1;
} }
ifindex = if_nametoindex(argv[1]); ifindex = if_nametoindex(argv[optind]);
if (!ifindex) { if (!ifindex) {
perror("if_nametoindex"); perror("if_nametoindex");
return 1; return 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment