summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/rule.h1
-rw-r--r--src/rule.c14
2 files changed, 15 insertions, 0 deletions
diff --git a/include/rule.h b/include/rule.h
index 072cff81..6c373e69 100644
--- a/include/rule.h
+++ b/include/rule.h
@@ -128,6 +128,7 @@ extern struct chain *chain_lookup(const struct table *table,
const struct handle *h);
extern const char *family2str(unsigned int family);
+extern void chain_print_plain(const struct chain *chain);
/**
* struct rule - nftables rule
diff --git a/src/rule.c b/src/rule.c
index accff0fa..858149ed 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -401,6 +401,20 @@ static void chain_print(const struct chain *chain)
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;