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: dc378a1ab5 ("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>
This commit is contained in:
Ioana Ciornei 2019-01-09 17:06:55 +00:00 committed by Daniel Borkmann
parent e3ca63de8a
commit 11b36abc24
1 changed files with 1 additions and 1 deletions

View File

@ -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;