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-save.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'iptables/xtables-save.c') diff --git a/iptables/xtables-save.c b/iptables/xtables-save.c index 8bcc31fd..1652fbbc 100644 --- a/iptables/xtables-save.c +++ b/iptables/xtables-save.c @@ -26,10 +26,14 @@ #include #endif +#define prog_name xtables_globals.program_name +#define prog_vers xtables_globals.program_version + static bool show_counters = false; static const struct option options[] = { {.name = "counters", .has_arg = false, .val = 'c'}, + {.name = "version", .has_arg = false, .val = 'V'}, {.name = "dump", .has_arg = false, .val = 'd'}, {.name = "table", .has_arg = true, .val = 't'}, {.name = "modprobe", .has_arg = true, .val = 'M'}, @@ -101,7 +105,7 @@ xtables_save_main(int family, const char *progname, int argc, char *argv[]) exit(1); } - while ((c = getopt_long(argc, argv, "bcdt:M:f:46", options, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "bcdt:M:f:46V", options, NULL)) != -1) { switch (c) { case 'b': fprintf(stderr, "-b/--binary option is not implemented\n"); @@ -142,6 +146,9 @@ xtables_save_main(int family, const char *progname, int argc, char *argv[]) h.family = AF_INET6; xtables_set_nfproto(AF_INET6); break; + case 'V': + printf("%s v%s (nf_tables)\n", prog_name, prog_vers); + exit(0); default: fprintf(stderr, "Look at manual page `xtables-save.8' for more information.\n"); -- cgit v1.2.3