summaryrefslogtreecommitdiffstats
path: root/iptables
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2018-06-18 13:27:59 +0200
committerFlorian Westphal <fw@strlen.de>2018-06-18 14:52:07 +0200
commitc9f5e18d72d3a010e9a53024290f9f4802ada9fd (patch)
treeb4679a9e2e2ace115ba45dc0cc18efdd40a34b98 /iptables
parente5fed16ab0b0da71dc92b052b3858d20ad9d542b (diff)
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 <laforge@gnumonks.org> Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'iptables')
-rw-r--r--iptables/ip6tables-restore.c2
-rw-r--r--iptables/ip6tables-save.c9
-rw-r--r--iptables/ip6tables.c2
-rw-r--r--iptables/iptables-restore.c2
-rw-r--r--iptables/iptables-save.c9
-rw-r--r--iptables/iptables.c2
-rw-r--r--iptables/xtables-arp.c2
-rw-r--r--iptables/xtables-eb.c2
-rw-r--r--iptables/xtables-restore.c2
-rw-r--r--iptables/xtables-save.c9
-rw-r--r--iptables/xtables-translate.c6
-rw-r--r--iptables/xtables.c2
12 files changed, 37 insertions, 12 deletions
diff --git a/iptables/ip6tables-restore.c b/iptables/ip6tables-restore.c
index 47310f20..ceffa616 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 8e3a6afd..5085982b 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 6954c252..12f82c7f 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 074552af..39198752 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 d59bd34a..d694d212 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 acacf182..fe9fd15b 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 c4cda7e0..eb03beb7 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 72559075..e22181ee 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 3270ec02..4a768535 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 8bcc31fd..1652fbbc 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 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);
}
}
diff --git a/iptables/xtables.c b/iptables/xtables.c
index 7476c974..e03e8f31 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);