All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Changed type of chain.priority from unsigned int to int.
@ 2014-06-09 21:39 Hendrik Schwartke
  2014-06-10 10:52 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Hendrik Schwartke @ 2014-06-09 21:39 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Hendrik Schwartke

This removes a bug that displays strange hook priorities
like "type route hook output priority 4294967146".
---
 include/rule.h |    2 +-
 src/netlink.c  |    6 +++---
 src/rule.c     |    4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/rule.h b/include/rule.h
index ebdafe8..db91406 100644
--- a/include/rule.h
+++ b/include/rule.h
@@ -115,7 +115,7 @@ struct chain {
 	uint32_t		flags;
 	const char		*hookstr;
 	unsigned int		hooknum;
-	unsigned int		priority;
+	int			priority;
 	const char		*type;
 	struct scope		scope;
 	struct list_head	rules;
diff --git a/src/netlink.c b/src/netlink.c
index edefc76..2e7c572 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -485,7 +485,7 @@ static int netlink_add_chain_compat(struct netlink_ctx *ctx,
 	if (chain != NULL && chain->flags & CHAIN_F_BASECHAIN) {
 		nft_chain_attr_set_u32(nlc, NFT_CHAIN_ATTR_HOOKNUM,
 				       chain->hooknum);
-		nft_chain_attr_set_u32(nlc, NFT_CHAIN_ATTR_PRIO,
+		nft_chain_attr_set_s32(nlc, NFT_CHAIN_ATTR_PRIO,
 				       chain->priority);
 		nft_chain_attr_set_str(nlc, NFT_CHAIN_ATTR_TYPE,
 				       chain->type);
@@ -512,7 +512,7 @@ static int netlink_add_chain_batch(struct netlink_ctx *ctx,
 	if (chain != NULL && chain->flags & CHAIN_F_BASECHAIN) {
 		nft_chain_attr_set_u32(nlc, NFT_CHAIN_ATTR_HOOKNUM,
 				       chain->hooknum);
-		nft_chain_attr_set_u32(nlc, NFT_CHAIN_ATTR_PRIO,
+		nft_chain_attr_set_s32(nlc, NFT_CHAIN_ATTR_PRIO,
 				       chain->priority);
 		nft_chain_attr_set_str(nlc, NFT_CHAIN_ATTR_TYPE,
 				       chain->type);
@@ -667,7 +667,7 @@ static struct chain *netlink_delinearize_chain(struct netlink_ctx *ctx,
 		chain->hooknum       =
 			nft_chain_attr_get_u32(nlc, NFT_CHAIN_ATTR_HOOKNUM);
 		chain->priority      =
-			nft_chain_attr_get_u32(nlc, NFT_CHAIN_ATTR_PRIO);
+			nft_chain_attr_get_s32(nlc, NFT_CHAIN_ATTR_PRIO);
 		chain->type          =
 			xstrdup(nft_chain_attr_get_str(nlc, NFT_CHAIN_ATTR_TYPE));
 		chain->flags        |= CHAIN_F_BASECHAIN;
diff --git a/src/rule.c b/src/rule.c
index 43a3e11..a7bc6f4 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -418,7 +418,7 @@ static void chain_print(const struct chain *chain)
 
 	printf("\tchain %s {\n", chain->handle.chain);
 	if (chain->flags & CHAIN_F_BASECHAIN) {
-		printf("\t\t type %s hook %s priority %u;\n", chain->type,
+		printf("\t\t type %s hook %s priority %d;\n", chain->type,
 		       hooknum2str(chain->handle.family, chain->hooknum),
 		       chain->priority);
 	}
@@ -439,7 +439,7 @@ void chain_print_plain(const struct chain *chain)
 	       chain->handle.table, chain->handle.chain);
 
 	if (chain->flags & CHAIN_F_BASECHAIN) {
-		printf(" { type %s hook %s priority %u; }", chain->type,
+		printf(" { type %s hook %s priority %d; }", chain->type,
 		       hooknum2str(chain->handle.family, chain->hooknum),
 		       chain->priority);
 	}
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Changed type of chain.priority from unsigned int to int.
  2014-06-09 21:39 [PATCH] Changed type of chain.priority from unsigned int to int Hendrik Schwartke
@ 2014-06-10 10:52 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2014-06-10 10:52 UTC (permalink / raw)
  To: Hendrik Schwartke; +Cc: netfilter-devel

On Mon, Jun 09, 2014 at 11:39:32PM +0200, Hendrik Schwartke wrote:
> This removes a bug that displays strange hook priorities
> like "type route hook output priority 4294967146".

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-10 10:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-09 21:39 [PATCH] Changed type of chain.priority from unsigned int to int Hendrik Schwartke
2014-06-10 10:52 ` Pablo Neira Ayuso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.