summaryrefslogtreecommitdiffstats
path: root/iptables/xtables-restore.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2013-02-23 18:27:08 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2013-12-30 23:50:26 +0100
commit3f7877e6be987bb94897c03a45945725389a6f5c (patch)
tree6000a614aa23fa8c89b2ba13c10d758c11f18815 /iptables/xtables-restore.c
parent077785df023ad8947d44d19769bc6d91e3917633 (diff)
xtables-restore: add -4 and -6 support
Now you can specify: xtables-restore -6 < my-ip6tables-ruleset to restore the IPv6 rule-set. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'iptables/xtables-restore.c')
-rw-r--r--iptables/xtables-restore.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/iptables/xtables-restore.c b/iptables/xtables-restore.c
index c62b0a9a..3b14a9f7 100644
--- a/iptables/xtables-restore.c
+++ b/iptables/xtables-restore.c
@@ -36,6 +36,8 @@ static const struct option options[] = {
{.name = "noflush", .has_arg = false, .val = 'n'},
{.name = "modprobe", .has_arg = true, .val = 'M'},
{.name = "table", .has_arg = true, .val = 'T'},
+ {.name = "ipv4", .has_arg = false, .val = '4'},
+ {.name = "ipv6", .has_arg = false, .val = '6'},
{NULL},
};
@@ -193,7 +195,7 @@ xtables_restore_main(int argc, char *argv[])
nft_init(&h);
- while ((c = getopt_long(argc, argv, "bcvthnM:T:", options, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "bcvthnM:T:46", options, NULL)) != -1) {
switch (c) {
case 'b':
binary = 1;
@@ -220,6 +222,12 @@ xtables_restore_main(int argc, char *argv[])
case 'T':
tablename = optarg;
break;
+ case '4':
+ h.family = AF_INET;
+ break;
+ case '6':
+ h.family = AF_INET6;
+ break;
}
}