Patchwork [libnftables,1/7] chain: change policy2str function to nft_verdict2str function

login
register
mail settings
Submitter Alvaro Neira
Date July 31, 2013, 1:20 p.m.
Message ID <20130731132051.29730.53717.stgit@Ph0enix>
Download mbox | patch
Permalink /patch/263695/
State Accepted
Headers show

Comments

Alvaro Neira - July 31, 2013, 1:20 p.m.
From: Álvaro Neira Ayuso <alvaroneay@gmail.com>

Signed-off-by: Alvaro Neira Ayuso <alvaroneay@gmail.com>
---
 src/chain.c |   17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pablo Neira - July 31, 2013, 5:14 p.m.
Applied from 1/7 to 7/7, I like that you have put care on these
series.

thanks Alvaro.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/src/chain.c b/src/chain.c
index 14db5f7..621794c 100644
--- a/src/chain.c
+++ b/src/chain.c
@@ -659,19 +659,6 @@  int nft_chain_parse(struct nft_chain *c, enum nft_chain_parse_type type,
 }
 EXPORT_SYMBOL(nft_chain_parse);
 
-static const char *policy2str(int policy)
-{
-	switch (policy) {
-	case NF_ACCEPT:
-		return "accept";
-	case NF_DROP:
-		return "drop";
-	default:
-		break;
-	}
-	return "unknown";
-}
-
 static int nft_chain_snprintf_json(char *buf, size_t size, struct nft_chain *c)
 {
 	int ret, len = size, offset = 0;
@@ -698,7 +685,7 @@  static int nft_chain_snprintf_json(char *buf, size_t size, struct nft_chain *c)
 				"\"prio\": %d,"
 				"\"policy\": \"%s\"",
 			c->type, hooknum2str_array[c->hooknum], c->prio,
-			policy2str(c->policy));
+			nft_verdict2str(c->policy));
 		SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
 	}
 
@@ -762,7 +749,7 @@  static int nft_chain_snprintf_default(char *buf, size_t size,
 			       " type %s hook %s prio %d policy %s use %d "
 			       "packets %"PRIu64" bytes %"PRIu64"",
 			       c->type, hooknum2str_array[c->hooknum], c->prio,
-			       policy2str(c->policy), c->use,
+			       nft_verdict2str(c->policy), c->use,
 			       c->packets, c->bytes);
 		SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
 	}