-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) Suggested-by: Harald Welte <laforge@xxxxxxxxxxxx> Signed-off-by: Florian Westphal <fw@xxxxxxxxx> --- iptables/ip6tables-restore.c | 2 +- iptables/ip6tables-save.c | 9 ++++++++- iptables/ip6tables.c | 2 +- iptables/iptables-restore.c | 2 +- iptables/iptables-save.c | 9 ++++++++- iptables/iptables.c | 2 +- iptables/xtables-arp.c | 2 +- iptables/xtables-eb.c | 2 +- iptables/xtables-restore.c | 2 +- iptables/xtables-save.c | 9 ++++++++- iptables/xtables-translate.c | 6 +++++- iptables/xtables.c | 2 +- 12 files changed, 37 insertions(+), 12 deletions(-) diff --git a/iptables/ip6tables-restore.c b/iptables/ip6tables-restore.c index 47310f20b936..ceffa616a03f 100644 --- a/iptables/ip6tables-restore.c +++ b/iptables/ip6tables-restore.c @@ -228,7 +228,7 @@ int ip6tables_restore_main(int argc, char *argv[]) verbose = 1; break; case 'V': - printf("%s v%s\n", prog_name, prog_vers); + printf("%s v%s (legacy)\n", prog_name, prog_vers); exit(0); case 't': testing = 1; diff --git a/iptables/ip6tables-save.c b/iptables/ip6tables-save.c index 8e3a6afd939d..5085982bfc19 100644 --- a/iptables/ip6tables-save.c +++ b/iptables/ip6tables-save.c @@ -19,6 +19,9 @@ #include "ip6tables.h" #include "ip6tables-multi.h" +#define prog_name ip6tables_globals.program_name +#define prog_vers ip6tables_globals.program_version + static int show_counters; static const struct option options[] = { @@ -27,6 +30,7 @@ static const struct option options[] = { {.name = "table", .has_arg = true, .val = 't'}, {.name = "modprobe", .has_arg = true, .val = 'M'}, {.name = "file", .has_arg = true, .val = 'f'}, + {.name = "version", .has_arg = false, .val = 'V'}, {NULL}, }; @@ -146,7 +150,7 @@ int ip6tables_save_main(int argc, char *argv[]) init_extensions6(); #endif - while ((c = getopt_long(argc, argv, "bcdt:M:f:", options, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "bcdt:M:f:V", options, NULL)) != -1) { switch (c) { case 'b': fprintf(stderr, "-b/--binary option is not implemented\n"); @@ -180,6 +184,9 @@ int ip6tables_save_main(int argc, char *argv[]) case 'd': do_output(tablename); exit(0); + case 'V': + printf("%s v%s (legacy)\n", prog_name, prog_vers); + exit(0); default: fprintf(stderr, "Look at manual page `ip6tables-save.8' for more information.\n"); diff --git a/iptables/ip6tables.c b/iptables/ip6tables.c index 6954c25228d5..12f82c7f831a 100644 --- a/iptables/ip6tables.c +++ b/iptables/ip6tables.c @@ -1667,7 +1667,7 @@ int do_command6(int argc, char *argv[], char **table, if (cs.invert) printf("Not %s ;-)\n", prog_vers); else - printf("%s v%s\n", + printf("%s v%s (legacy)\n", prog_name, prog_vers); exit(0); diff --git a/iptables/iptables-restore.c b/iptables/iptables-restore.c index 074552af5dc7..39198752a22a 100644 --- a/iptables/iptables-restore.c +++ b/iptables/iptables-restore.c @@ -226,7 +226,7 @@ iptables_restore_main(int argc, char *argv[]) verbose = 1; break; case 'V': - printf("%s v%s\n", prog_name, prog_vers); + printf("%s v%s (legacy)\n", prog_name, prog_vers); exit(0); case 't': testing = 1; diff --git a/iptables/iptables-save.c b/iptables/iptables-save.c index d59bd34a62b6..d694d212d7ed 100644 --- a/iptables/iptables-save.c +++ b/iptables/iptables-save.c @@ -18,6 +18,9 @@ #include "iptables.h" #include "iptables-multi.h" +#define prog_name iptables_globals.program_name +#define prog_vers iptables_globals.program_version + static int show_counters; static const struct option options[] = { @@ -26,6 +29,7 @@ static const struct option options[] = { {.name = "table", .has_arg = true, .val = 't'}, {.name = "modprobe", .has_arg = true, .val = 'M'}, {.name = "file", .has_arg = true, .val = 'f'}, + {.name = "version", .has_arg = false, .val = 'V'}, {NULL}, }; @@ -145,7 +149,7 @@ iptables_save_main(int argc, char *argv[]) init_extensions4(); #endif - while ((c = getopt_long(argc, argv, "bcdt:M:f:", options, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "bcdt:M:f:V", options, NULL)) != -1) { switch (c) { case 'b': fprintf(stderr, "-b/--binary option is not implemented\n"); @@ -179,6 +183,9 @@ iptables_save_main(int argc, char *argv[]) case 'd': do_output(tablename); exit(0); + case 'V': + printf("%s v%s (legacy)\n", prog_name, prog_vers); + exit(0); default: fprintf(stderr, "Look at manual page `iptables-save.8' for more information.\n"); diff --git a/iptables/iptables.c b/iptables/iptables.c index acacf182a834..fe9fd15b93df 100644 --- a/iptables/iptables.c +++ b/iptables/iptables.c @@ -1657,7 +1657,7 @@ int do_command4(int argc, char *argv[], char **table, if (cs.invert) printf("Not %s ;-)\n", prog_vers); else - printf("%s v%s\n", + printf("%s v%s (legacy)\n", prog_name, prog_vers); exit(0); diff --git a/iptables/xtables-arp.c b/iptables/xtables-arp.c index c4cda7e0cf31..eb03beb7b72c 100644 --- a/iptables/xtables-arp.c +++ b/iptables/xtables-arp.c @@ -1259,7 +1259,7 @@ int do_commandarp(struct nft_handle *h, int argc, char *argv[], char **table) if (invert) printf("Not %s ;-)\n", program_version); else - printf("%s v%s\n", + printf("%s v%s (nf_tables)\n", program_name, program_version); exit(0); diff --git a/iptables/xtables-eb.c b/iptables/xtables-eb.c index 725590755901..e22181eebe60 100644 --- a/iptables/xtables-eb.c +++ b/iptables/xtables-eb.c @@ -941,7 +941,7 @@ print_zero: if (exec_style == EXEC_STYLE_DAEMON) xtables_error(PARAMETER_PROBLEM, "%s %s\n", prog_name, prog_vers); - printf("%s %s\n", prog_name, prog_vers); + printf("%s %s (nf_tables)\n", prog_name, prog_vers); exit(0); case 'h': /* Help */ #ifdef SILENT_DAEMON diff --git a/iptables/xtables-restore.c b/iptables/xtables-restore.c index 3270ec027f45..4a7685356095 100644 --- a/iptables/xtables-restore.c +++ b/iptables/xtables-restore.c @@ -485,7 +485,7 @@ xtables_restore_main(int family, const char *progname, int argc, char *argv[]) verbose = 1; break; case 'V': - printf("%s v%s\n", prog_name, prog_vers); + printf("%s v%s (nf_tables)\n", prog_name, prog_vers); exit(0); case 't': p.testing = 1; diff --git a/iptables/xtables-save.c b/iptables/xtables-save.c index 8bcc31fd9d48..1652fbbc5e2f 100644 --- a/iptables/xtables-save.c +++ b/iptables/xtables-save.c @@ -26,10 +26,14 @@ #include <dlfcn.h> #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"); diff --git a/iptables/xtables-translate.c b/iptables/xtables-translate.c index b08ac354dd73..f4c0f9cf5a18 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); } } diff --git a/iptables/xtables.c b/iptables/xtables.c index 7476c974451a..e03e8f317768 100644 --- a/iptables/xtables.c +++ b/iptables/xtables.c @@ -991,7 +991,7 @@ void do_parse(struct nft_handle *h, int argc, char *argv[], if (cs->invert) printf("Not %s ;-)\n", prog_vers); else - printf("%s v%s\n", + printf("%s v%s (nf_tables)\n", prog_name, prog_vers); exit(0); -- 2.17.1 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html