From c9f5e18d72d3a010e9a53024290f9f4802ada9fd Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Mon, 18 Jun 2018 13:27:59 +0200 Subject: xtables: add nf_tables vs. legacy postfix to version strings -V now yields: arptables vlibxtables.so.12 (nf_tables) ebtables 1.6.2 (nf_tables) ip6tables v1.6.2 (legacy) ip6tables v1.6.2 (nf_tables) ip6tables-restore v1.6.2 (nf_tables) ip6tables-save v1.6.2 (nf_tables) ip6tables-restore v1.6.2 (legacy) ip6tables-restore-translate v1.6.2 ip6tables-save v1.6.2 (legacy) ip6tables-translate v1.6.2 (nf_tables) iptables v1.6.2 (legacy) iptables v1.6.2 (nf_tables) iptables-restore v1.6.2 (nf_tables) iptables-save v1.6.2 (nf_tables) iptables-restore v1.6.2 (legacy) iptables-restore-translate v1.6.2 iptables-save v1.6.2 (legacy) iptables-translate v1.6.2 (nf_tables) This allows to see wheter "iptables" is using old set/getsockopt or new nf_tables infrastructure. Suggested-by: Harald Welte Signed-off-by: Florian Westphal --- iptables/xtables-translate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'iptables/xtables-translate.c') diff --git a/iptables/xtables-translate.c b/iptables/xtables-translate.c index b08ac354..f4c0f9cf 100644 --- a/iptables/xtables-translate.c +++ b/iptables/xtables-translate.c @@ -324,6 +324,7 @@ static void print_usage(const char *name, const char *version) static const struct option options[] = { { .name = "help", .has_arg = false, .val = 'h' }, { .name = "file", .has_arg = true, .val = 'f' }, + { .name = "version", .has_arg = false, .val = 'V' }, { NULL }, }; @@ -505,7 +506,7 @@ static int xtables_restore_xlate_main(int family, const char *progname, exit(EXIT_FAILURE); opterr = 0; - while ((c = getopt_long(argc, argv, "hf:", options, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "hf:V", options, NULL)) != -1) { switch (c) { case 'h': print_usage(argv[0], IPTABLES_VERSION); @@ -513,6 +514,9 @@ static int xtables_restore_xlate_main(int family, const char *progname, case 'f': file = optarg; break; + case 'V': + printf("%s v%s\n", argv[0], IPTABLES_VERSION); + exit(0); } } -- cgit v1.2.3