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

@@ -112,25 +112,6 @@ static void ipmark_tg_check(unsigned int flags)
"IPMARK target: Parameter --addr is required");
}
static void
ipmark_tg_print(const void *entry, const struct xt_entry_target *target,
int numeric)
{
const struct xt_ipmark_tginfo *info = (const void *)target->data;
if (info->selector == XT_IPMARK_SRC)
printf(" IPMARK src ip ");
else
printf(" IPMARK dst ip ");
if (info->shift != 0)
printf(" shift %u ", (unsigned int)info->shift);
if (info->andmask != ~0U)
printf(" and 0x%x ", (unsigned int)info->andmask);
if (info->ormask != 0)
printf(" or 0x%x ", (unsigned int)info->ormask);
}
static void
ipmark_tg_save(const void *entry, const struct xt_entry_target *target)
{
@@ -149,6 +130,14 @@ ipmark_tg_save(const void *entry, const struct xt_entry_target *target)
printf(" --or-mask 0x%x ", (unsigned int)info->ormask);
}
static void
ipmark_tg_print(const void *entry, const struct xt_entry_target *target,
int numeric)
{
printf(" -j IPMARK");
ipmark_tg_save(entry, target);
}
static struct xtables_target ipmark_tg_reg = {
.version = XTABLES_VERSION,
.name = "IPMARK",