netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [RFC] netfilter: don't assume NFPROTO_* are like PF_*
@ 2012-05-14 13:58 Alban Crequy
  2012-05-14 15:09 ` Jan Engelhardt
  0 siblings, 1 reply; 4+ messages in thread
From: Alban Crequy @ 2012-05-14 13:58 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Patrick McHardy
  Cc: Vincent Sanders, Javier Martinez Canillas, netfilter-devel,
	netdev, Alban Crequy

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 <alban.crequy@collabora.co.uk>
Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Reviewed-by: Vincent Sanders <vincent.sanders@collabora.co.uk>
---
 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

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

* Re: [PATCH] [RFC] netfilter: don't assume NFPROTO_* are like PF_*
  2012-05-14 13:58 [PATCH] [RFC] netfilter: don't assume NFPROTO_* are like PF_* Alban Crequy
@ 2012-05-14 15:09 ` Jan Engelhardt
  2012-05-14 15:42   ` Alban Crequy
  2012-05-14 19:06   ` Pablo Neira Ayuso
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Engelhardt @ 2012-05-14 15:09 UTC (permalink / raw)
  To: Alban Crequy
  Cc: Pablo Neira Ayuso, Patrick McHardy, Vincent Sanders,
	Javier Martinez Canillas, netfilter-devel, netdev


On Monday 2012-05-14 15:58, Alban Crequy wrote:
>--- 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.

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

* Re: [PATCH] [RFC] netfilter: don't assume NFPROTO_* are like PF_*
  2012-05-14 15:09 ` Jan Engelhardt
@ 2012-05-14 15:42   ` Alban Crequy
  2012-05-14 19:06   ` Pablo Neira Ayuso
  1 sibling, 0 replies; 4+ messages in thread
From: Alban Crequy @ 2012-05-14 15:42 UTC (permalink / raw)
  To: Jan Engelhardt
  Cc: Pablo Neira Ayuso, Patrick McHardy, Vincent Sanders,
	Javier Martinez Canillas, netfilter-devel, netdev

Le Mon, 14 May 2012 17:09:54 +0200 (CEST),
Jan Engelhardt <jengelh@inai.de> a écrit :

> 
> On Monday 2012-05-14 15:58, Alban Crequy wrote:
> >--- 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

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

* Re: [PATCH] [RFC] netfilter: don't assume NFPROTO_* are like PF_*
  2012-05-14 15:09 ` Jan Engelhardt
  2012-05-14 15:42   ` Alban Crequy
@ 2012-05-14 19:06   ` Pablo Neira Ayuso
  1 sibling, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2012-05-14 19:06 UTC (permalink / raw)
  To: Jan Engelhardt
  Cc: Alban Crequy, Patrick McHardy, Vincent Sanders,
	Javier Martinez Canillas, netfilter-devel, netdev

On Mon, May 14, 2012 at 05:09:54PM +0200, Jan Engelhardt wrote:
> 
> On Monday 2012-05-14 15:58, Alban Crequy wrote:
> >--- 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.

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

end of thread, other threads:[~2012-05-14 19:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-14 13:58 [PATCH] [RFC] netfilter: don't assume NFPROTO_* are like PF_* Alban Crequy
2012-05-14 15:09 ` Jan Engelhardt
2012-05-14 15:42   ` Alban Crequy
2012-05-14 19:06   ` Pablo Neira Ayuso

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).