[PATCH] [RFC] netfilter: don't assume NFPROTO_* are like PF_*

Subsystems: netfilter, the rest

STALE5229d REVIEWED: 2 (0M)

2 review trailers.

4 messages, 3 authors, 2012-05-14 · open the first message on its own page

[PATCH] [RFC] netfilter: don't assume NFPROTO_* are like PF_*

From: Alban Crequy <hidden>
Date: 2012-05-14 13:59:16

With this patch, NFPROTO_* constants don't have the same values as PF_*
constants.

Benefit: it makes NFPROTO_NUMPROTO smaller and saves space as arrays are
smaller.

Issues: might have missed a conversion. I grepped NF_HOOK, nf_register_hook,
nf_register_hooks, and xt_hook_link. So it is probably fine.

NFPROTO_* constants were introduced by commit 7e9c6e.

Signed-off-by: Alban Crequy <redacted>
Reviewed-by: Javier Martinez Canillas <redacted>
Reviewed-by: Vincent Sanders <redacted>
---
 include/linux/netfilter.h |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 29734be..89afadb 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -62,11 +62,11 @@ enum nf_inet_hooks {
 
 enum {
 	NFPROTO_UNSPEC =  0,
-	NFPROTO_IPV4   =  2,
-	NFPROTO_ARP    =  3,
-	NFPROTO_BRIDGE =  7,
-	NFPROTO_IPV6   = 10,
-	NFPROTO_DECNET = 12,
+	NFPROTO_IPV4,
+	NFPROTO_ARP,
+	NFPROTO_BRIDGE,
+	NFPROTO_IPV6,
+	NFPROTO_DECNET,
 	NFPROTO_NUMPROTO,
 };
 
-- 
1.7.2.5

Re: [PATCH] [RFC] netfilter: don't assume NFPROTO_* are like PF_*

From: Jan Engelhardt <hidden>
Date: 2012-05-14 15:09:54

On Monday 2012-05-14 15:58, Alban Crequy wrote:
quoted hunk
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -62,11 +62,11 @@ enum nf_inet_hooks {
enum {
	NFPROTO_UNSPEC =  0,
-	NFPROTO_IPV4   =  2,
-	NFPROTO_ARP    =  3,
-	NFPROTO_BRIDGE =  7,
-	NFPROTO_IPV6   = 10,
-	NFPROTO_DECNET = 12,
+	NFPROTO_IPV4,
+	NFPROTO_ARP,
+	NFPROTO_BRIDGE,
+	NFPROTO_IPV6,
+	NFPROTO_DECNET,
	NFPROTO_NUMPROTO,
};
This must not be changed under any circumstances. It is exported to
and used by userspace. (Except perhaps for NFPROTO_DECNET, which
refers to a quite dead protocol that I think no user parts have ever
used NFPROTO_DECNET.) I would consider it acceptable to change the
value for NFPROTO_DECNET if Pablo joins.

Re: [PATCH] [RFC] netfilter: don't assume NFPROTO_* are like PF_*

From: Alban Crequy <hidden>
Date: 2012-05-14 15:42:29

Le Mon, 14 May 2012 17:09:54 +0200 (CEST),
Jan Engelhardt [off-list ref] a écrit :
On Monday 2012-05-14 15:58, Alban Crequy wrote:
quoted
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -62,11 +62,11 @@ enum nf_inet_hooks {
enum {
	NFPROTO_UNSPEC =  0,
-	NFPROTO_IPV4   =  2,
-	NFPROTO_ARP    =  3,
-	NFPROTO_BRIDGE =  7,
-	NFPROTO_IPV6   = 10,
-	NFPROTO_DECNET = 12,
+	NFPROTO_IPV4,
+	NFPROTO_ARP,
+	NFPROTO_BRIDGE,
+	NFPROTO_IPV6,
+	NFPROTO_DECNET,
	NFPROTO_NUMPROTO,
};
This must not be changed under any circumstances. It is exported to
and used by userspace. (Except perhaps for NFPROTO_DECNET, which
refers to a quite dead protocol that I think no user parts have ever
used NFPROTO_DECNET.) I would consider it acceptable to change the
value for NFPROTO_DECNET if Pablo joins.
Thanks for the review. I didn't realize it was exported to and used by
userspace. I would drop this patch then.

Alban

Re: [PATCH] [RFC] netfilter: don't assume NFPROTO_* are like PF_*

From: Pablo Neira Ayuso <pablo@netfilter.org>
Date: 2012-05-14 19:06:35

On Mon, May 14, 2012 at 05:09:54PM +0200, Jan Engelhardt wrote:
On Monday 2012-05-14 15:58, Alban Crequy wrote:
quoted
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -62,11 +62,11 @@ enum nf_inet_hooks {
enum {
	NFPROTO_UNSPEC =  0,
-	NFPROTO_IPV4   =  2,
-	NFPROTO_ARP    =  3,
-	NFPROTO_BRIDGE =  7,
-	NFPROTO_IPV6   = 10,
-	NFPROTO_DECNET = 12,
+	NFPROTO_IPV4,
+	NFPROTO_ARP,
+	NFPROTO_BRIDGE,
+	NFPROTO_IPV6,
+	NFPROTO_DECNET,
	NFPROTO_NUMPROTO,
};
This must not be changed under any circumstances. It is exported to
and used by userspace. (Except perhaps for NFPROTO_DECNET, which
refers to a quite dead protocol that I think no user parts have ever
used NFPROTO_DECNET.) I would consider it acceptable to change the
value for NFPROTO_DECNET if Pablo joins.
If there is some remote posibility to break userspace code, I won't
take the patch, sorry.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help