* [PATCH] don't use __be16 in files used by userspace
@ 2005-10-07 10:31 Harald Welte
2005-10-07 20:24 ` David S. Miller
0 siblings, 1 reply; 4+ messages in thread
From: Harald Welte @ 2005-10-07 10:31 UTC (permalink / raw)
To: Netfilter Development Mailinglist; +Cc: David Miller
[-- Attachment #1: Type: text/plain, Size: 2337 bytes --]
Hi Dave!
This (or a different solution such as
"#ifndef __KERNEL__ #define __be16 #endif" needs to go in before 2.6.14
is released, since otherwise we'd break userspace compilation :(
Please apply, thanks.
[NETFILTER] do not use __be16 in headerfile that is used by userspace
__be16 is not defined in userspace, and therefore iptables cannot be
compiled with such types in ip_conntrack_tuple.h. Yes, we can add a bogus
#define to iptables userspace, but we can only do so for new releases, not
for old ones. Since we do not want to loose the ability to compile old
iptables programs on new kernels, we revert the change.
Signed-off-by: Harald Welte <laforge@netfilter.org>
---
commit 4714eea267d67e65aabb6518cbfa81b8c45c2147
tree caf15c3b67ea6595db868305e7042cbea3f01edf
parent d5b3f0a9fdcf7881d3b6efedd862aef6d561db03
author Harald Welte <laforge@netfilter.org> Fri, 07 Oct 2005 12:59:02 +0200
committer Harald Welte <laforge@netfilter.org> Fri, 07 Oct 2005 12:59:02 +0200
include/linux/netfilter_ipv4/ip_conntrack_tuple.h | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
--- a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
@@ -17,7 +17,7 @@ union ip_conntrack_manip_proto
u_int16_t all;
struct {
- __be16 port;
+ u_int16_t port;
} tcp;
struct {
u_int16_t port;
@@ -29,7 +29,7 @@ union ip_conntrack_manip_proto
u_int16_t port;
} sctp;
struct {
- __be16 key; /* key is 32bit, pptp only uses 16 */
+ u_int16_t key; /* key is 32bit, pptp only uses 16 */
} gre;
};
@@ -65,7 +65,7 @@ struct ip_conntrack_tuple
u_int16_t port;
} sctp;
struct {
- __be16 key; /* key is 32bit,
+ u_int16_t key; /* key is 32bit,
* pptp only uses 16 */
} gre;
} u;
--
- Harald Welte <laforge@netfilter.org> http://netfilter.org/
============================================================================
"Fragmentation is like classful addressing -- an interesting early
architectural error that shows how much experimentation was going
on while IP was being designed." -- Paul Vixie
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] don't use __be16 in files used by userspace
2005-10-07 10:31 [PATCH] don't use __be16 in files used by userspace Harald Welte
@ 2005-10-07 20:24 ` David S. Miller
2005-10-07 22:15 ` Harald Welte
0 siblings, 1 reply; 4+ messages in thread
From: David S. Miller @ 2005-10-07 20:24 UTC (permalink / raw)
To: laforge; +Cc: netfilter-devel
From: Harald Welte <laforge@netfilter.org>
Date: Fri, 7 Oct 2005 12:31:05 +0200
> This (or a different solution such as
> "#ifndef __KERNEL__ #define __be16 #endif" needs to go in before 2.6.14
> is released, since otherwise we'd break userspace compilation :(
I'm not applying this.
The reverting of endianness annotations would be a serious
regression. If we need userland compatible defines we can
either:
1) Do what iproute2 and friends do, which is ship sanitized
kernel headers in their userland source tree.
2) As you suggest have a suitable __be* et al. define when
__KERNEL__ is not set.
Actually... What's the problem anyways? #2 seems to already
be done.
In linux/types.h we have:
#ifdef __CHECKER__
#define __bitwise __attribute__((bitwise))
#else
#define __bitwise
#endif
typedef __u16 __bitwise __le16;
typedef __u16 __bitwise __be16;
typedef __u32 __bitwise __le32;
typedef __u32 __bitwise __be32;
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
typedef __u64 __bitwise __le64;
typedef __u64 __bitwise __be64;
#endif
And this should just work.
That isn't even protected by __KERNEL__, it's fully visible to
userspace when you include linux/types.h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] don't use __be16 in files used by userspace
2005-10-07 20:24 ` David S. Miller
@ 2005-10-07 22:15 ` Harald Welte
2005-10-10 4:47 ` David S. Miller
0 siblings, 1 reply; 4+ messages in thread
From: Harald Welte @ 2005-10-07 22:15 UTC (permalink / raw)
To: David S. Miller; +Cc: netfilter-devel
[-- Attachment #1: Type: text/plain, Size: 3330 bytes --]
On Fri, Oct 07, 2005 at 01:24:56PM -0700, David S. Miller wrote:
> From: Harald Welte <laforge@netfilter.org>
> Date: Fri, 7 Oct 2005 12:31:05 +0200
>
> > This (or a different solution such as
> > "#ifndef __KERNEL__ #define __be16 #endif" needs to go in before 2.6.14
> > is released, since otherwise we'd break userspace compilation :(
>
> I'm not applying this.
As I almost expected. But it was worth a try ;)
> The reverting of endianness annotations would be a serious
> regression. If we need userland compatible defines we can
> either:
>
> 1) Do what iproute2 and friends do, which is ship sanitized
> kernel headers in their userland source tree.
we're thinking about this, but concluded for ip_conntrack it's too late
now. There is too much interdependency between dozens of files, so we'd
have to have a script that grep/sed's what we really need :(
For nf_conntrack (in my git tree, pending for 2.6.15), we have a
strict separation of all header files. Only the absolute minimum that
is required by userspace goes into include/linux/netfilter/, and
everything else into include/net/netfilter.
This way we make sure we can make a clean copy of everything in
include/linux/netfilter/* and put that into userspace (i.e.
libnfnetlink_conntrack, ...)
> 2) As you suggest have a suitable __be* et al. define when
> __KERNEL__ is not set.
>
> Actually... What's the problem anyways? #2 seems to already
> be done.
include/linux/netfilter_ipv4/ip_conntrack_tuple.h doesn't include
<linux/types.h>, and the (existing, old) userspace code has no reason to
include it before ip_conntrack_tuple.h either.
So as I just confirmed, adding a #include seems to be fixing the
problem.
Please apply the patch below instead. Thanks!
[NETFILTER] Add missing include to ip_conntrack_tuple.h
Without this #include, __be16 is not defined and userspace programs
will break.
Signed-off-by: Harald Welte <laforge@netfilter.org>
---
commit 0b4f28e7d0a469b2877ac18619af9c9695972c09
tree ad8281918b1cee5678acca048ab502bc346364f5
parent f3c27d8351a2ad3aa586549680b83e19670d6815
author Harald Welte <laforge@netfilter.org> Sat, 08 Oct 2005 00:15:03 +0200
committer Harald Welte <laforge@netfilter.org> Sat, 08 Oct 2005 00:15:03 +0200
include/linux/netfilter_ipv4/ip_conntrack_tuple.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
--- a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
@@ -1,6 +1,8 @@
#ifndef _IP_CONNTRACK_TUPLE_H
#define _IP_CONNTRACK_TUPLE_H
+#include <linux/types.h>
+
/* A `tuple' is a structure containing the information to uniquely
identify a connection. ie. if two packets have the same tuple, they
are in the same connection; if not, they are not.
--
- Harald Welte <laforge@netfilter.org> http://netfilter.org/
============================================================================
"Fragmentation is like classful addressing -- an interesting early
architectural error that shows how much experimentation was going
on while IP was being designed." -- Paul Vixie
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] don't use __be16 in files used by userspace
2005-10-07 22:15 ` Harald Welte
@ 2005-10-10 4:47 ` David S. Miller
0 siblings, 0 replies; 4+ messages in thread
From: David S. Miller @ 2005-10-10 4:47 UTC (permalink / raw)
To: laforge; +Cc: netfilter-devel
From: Harald Welte <laforge@netfilter.org>
Date: Sat, 8 Oct 2005 00:15:00 +0200
> [NETFILTER] Add missing include to ip_conntrack_tuple.h
>
> Without this #include, __be16 is not defined and userspace programs
> will break.
>
> Signed-off-by: Harald Welte <laforge@netfilter.org>
Now that looks a lot better, applied.
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-10-10 4:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-07 10:31 [PATCH] don't use __be16 in files used by userspace Harald Welte
2005-10-07 20:24 ` David S. Miller
2005-10-07 22:15 ` Harald Welte
2005-10-10 4:47 ` David S. Miller
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.