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

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
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;