Lest generalize the chain_print() function, so we can print a plain chain
as the user typed in the basic CLI.
Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
const struct handle *h);
extern const char *family2str(unsigned int family);
+extern void chain_print_plain(const struct chain *chain);
/**
* struct rule - nftables rule
printf("\t}\n");
}
+void chain_print_plain(const struct chain *chain)
+{
+ printf("chain %s %s %s", family2str(chain->handle.family),
+ chain->handle.table, chain->handle.chain);
+
+ if (chain->flags & CHAIN_F_BASECHAIN) {
+ printf(" { type %s hook %s priority %u; }", chain->type,
+ hooknum2str(chain->handle.family, chain->hooknum),
+ chain->priority);
+ }
+
+ printf("\n");
+}
+
struct table *table_alloc(void)
{
struct table *table;