netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hendrik Schwartke <hendrik@os-t.de>
To: netfilter-devel@vger.kernel.org
Cc: Hendrik Schwartke <hendrik@os-t.de>
Subject: [PATCH] Changed type of chain.priority from unsigned int to int.
Date: Mon,  9 Jun 2014 23:39:32 +0200	[thread overview]
Message-ID: <1402349972-18658-1-git-send-email-hendrik@os-t.de> (raw)

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


             reply	other threads:[~2014-06-09 21:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-09 21:39 Hendrik Schwartke [this message]
2014-06-10 10:52 ` [PATCH] Changed type of chain.priority from unsigned int to int Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1402349972-18658-1-git-send-email-hendrik@os-t.de \
    --to=hendrik@os-t.de \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).