]> git.baikalelectronics.ru Git - kernel.git/commitdiff
samples: bpf: user proper argument index
authorIoana Ciornei <ioana.ciornei@nxp.com>
Wed, 9 Jan 2019 17:06:55 +0000 (17:06 +0000)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 10 Jan 2019 14:54:47 +0000 (15:54 +0100)
Use optind as index for argv instead of a hardcoded value.
When the program has options this leads to improper parameter handling.

Fixes: 787841a64a81 ("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>
samples/bpf/xdp1_user.c

index 0a197f86ac43a7a28b281d36efeedb5d423dd8dd..8bfda95c77ad77ade1bc2b553d8940f3da0f60a8 100644 (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;