From 43ac0090824f5c08ea13add64ace64f9ead8ef1b Mon Sep 17 00:00:00 2001 From: Arturo Borrero Date: Mon, 14 Apr 2014 12:17:19 +0200 Subject: rule: generalize chain_print() 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 Signed-off-by: Pablo Neira Ayuso --- src/rule.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/rule.c') 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; -- cgit v1.2.3