summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2013-02-23 18:30:36 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2013-12-30 23:50:26 +0100
commit6fc6cb2d223da8d7fdf745cd783af8bcbc758b9f (patch)
tree120223856aa2671d822d77092f92891f6f4f29ce
parent3f7877e6be987bb94897c03a45945725389a6f5c (diff)
xtables-save: add -4 and -6 support
Now you can specify: xtables-save -6 > my-ip6tables-ruleset to dump the IPv6 rule-set. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--iptables/xtables-save.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/iptables/xtables-save.c b/iptables/xtables-save.c
index 05d06b1e..111ad4be 100644
--- a/iptables/xtables-save.c
+++ b/iptables/xtables-save.c
@@ -32,6 +32,8 @@ static const struct option options[] = {
{.name = "dump", .has_arg = false, .val = 'd'},
{.name = "table", .has_arg = true, .val = 't'},
{.name = "modprobe", .has_arg = true, .val = 'M'},
+ {.name = "ipv4", .has_arg = false, .val = '4'},
+ {.name = "ipv6", .has_arg = false, .val = '6'},
{NULL},
};
@@ -96,7 +98,7 @@ xtables_save_main(int argc, char *argv[])
#endif
nft_init(&h);
- while ((c = getopt_long(argc, argv, "bcdt:", options, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "bcdt:46", options, NULL)) != -1) {
switch (c) {
case 'c':
show_counters = true;
@@ -112,6 +114,12 @@ xtables_save_main(int argc, char *argv[])
case 'd':
do_output(&h, tablename, show_counters);
exit(0);
+ case '4':
+ h.family = AF_INET;
+ break;
+ case '6':
+ h.family = AF_INET6;
+ break;
}
}