extensions: make print (iptables -L) output the same as save (-S)

This commit is contained in:
Jan Engelhardt
2013-05-30 17:16:56 +02:00
parent 6a60b5ab75
commit 13db8d78c9
21 changed files with 150 additions and 331 deletions

View File

@@ -103,34 +103,6 @@ static void rawdnat_tg_check(unsigned int flags)
"\"--to-destination\" is required.");
}
static void
rawdnat_tg4_print(const void *entry, const struct xt_entry_target *target,
int numeric)
{
const struct xt_rawnat_tginfo *info = (const void *)target->data;
if (!numeric && info->mask == 32)
printf(" to-destination %s ",
xtables_ipaddr_to_anyname(&info->addr.in));
else
printf(" to-destination %s/%u ",
xtables_ipaddr_to_numeric(&info->addr.in), info->mask);
}
static void
rawdnat_tg6_print(const void *entry, const struct xt_entry_target *target,
int numeric)
{
const struct xt_rawnat_tginfo *info = (const void *)target->data;
if (!numeric && info->mask == 128)
printf(" to-destination %s ",
xtables_ip6addr_to_anyname(&info->addr.in6));
else
printf(" to-destination %s/%u ",
xtables_ip6addr_to_numeric(&info->addr.in6), info->mask);
}
static void
rawdnat_tg4_save(const void *entry, const struct xt_entry_target *target)
{
@@ -141,6 +113,14 @@ rawdnat_tg4_save(const void *entry, const struct xt_entry_target *target)
info->mask);
}
static void
rawdnat_tg4_print(const void *entry, const struct xt_entry_target *target,
int numeric)
{
printf(" -j RAWDNAT");
rawdnat_tg4_save(entry, target);
}
static void
rawdnat_tg6_save(const void *entry, const struct xt_entry_target *target)
{
@@ -151,6 +131,14 @@ rawdnat_tg6_save(const void *entry, const struct xt_entry_target *target)
info->mask);
}
static void
rawdnat_tg6_print(const void *entry, const struct xt_entry_target *target,
int numeric)
{
printf(" -j RAWDNAT");
rawdnat_tg6_save(entry, target);
}
static struct xtables_target rawdnat_tg_reg[] = {
{
.version = XTABLES_VERSION,