From: "Chris Poon" Subject: [PATCH] big endian patch against netfilter after PPTP NAT patch Date: Fri, 31 Jan 2003 16:53:44 -0700 Sender: netfilter-devel-admin@lists.netfilter.org Message-ID: <771F217D7A4AF84494632457889470A487DCDC@bcmsg011.corp.ads> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----_=_NextPart_000_01C2C983.FD564AA9" Return-path: To: "'netfilter-devel@lists.netfilter.org'" Errors-To: netfilter-devel-admin@lists.netfilter.org List-Help: List-Post: List-Subscribe: , List-Unsubscribe: , List-Archive: List-Id: netfilter-devel.vger.kernel.org This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01C2C983.FD564AA9 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C2C983.FD564AA9" Content-Transfer-Encoding: 7bit ------_=_NextPart_001_01C2C983.FD564AA9 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit This is related to the problems I found with expecting related connections on Sparc64 platform. This is really a patch against the PPTP NAT patch, which changed the unions in ip_conntrack_manip_proto and ip_conntrack_tuple from strictly a 16 bit union to a mixed 16/32 bit and 16/32/64 bit union (the later case in ip_conntrack_tuple.dst.u). The patch will only apply to ip_conntrack_tuple.h after the PPTP patch is installed, and I did the diff right on the file. Issue stem from the assumption of little endian platform when the PPTP patch changed the unions, and compiler padding basically screw up the actual location of various fields. I have added the #ifdef around the dummy fields so it should be usable by every platform, and my tests show that expectations for related connections will now be found so I am one happy man.... other than the long kernel compile on my Ultra 10 (using an RedHat like kernel RPM build - PLD for those who are interested), it wasn't too hard to track down the problem, and now I wonder how many people are using big-endian machines to run iptables, let alone a sparc64. Enjoy ------_=_NextPart_001_01C2C983.FD564AA9 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit [PATCH] big endian patch against netfilter after PPTP NAT patch

This is related to the problems I found with expecting related connections
on Sparc64 platform. This is really a patch against the PPTP NAT patch,
which changed the unions in ip_conntrack_manip_proto and
ip_conntrack_tuple from strictly a 16 bit union to a mixed 16/32 bit and
16/32/64 bit union (the later case in ip_conntrack_tuple.dst.u). The patch
will only apply to ip_conntrack_tuple.h after the PPTP patch is installed,
and I did the diff right on the file.

Issue stem from the assumption of little endian platform when the PPTP
patch changed the unions, and compiler padding basically screw up the
actual location of various fields. I have added the #ifdef around the
dummy fields so it should be usable by every platform, and my tests show
that expectations for related connections will now be found so I am one
happy man.... other than the long kernel compile on my Ultra 10 (using
an RedHat like kernel RPM build - PLD for those who are interested), it
wasn't too hard to track down the problem, and now I wonder how many
people are using big-endian machines to run iptables, let alone a sparc64.

Enjoy

  ------_=_NextPart_001_01C2C983.FD564AA9-- ------_=_NextPart_000_01C2C983.FD564AA9 Content-Type: application/octet-stream; name=netfilter.patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=netfilter.patch --- linux-2.4.20.orig/include/linux/netfilter_ipv4/ip_conntrack_tuple.h = Thu Jan 30 09:33:31 2003=0A= +++ linux-2.4.20.orig/include/linux/netfilter_ipv4/ip_conntrack_tuple.h = Fri Jan 31 10:28:10 2003=0A= @@ -17,12 +17,21 @@=0A= u_int32_t all;=0A= =0A= struct {=0A= +#if defined(__BIG_ENDIAN)=0A= + u_int16_t dummy;=0A= +#endif=0A= u_int16_t port;=0A= } tcp;=0A= struct {=0A= +#if defined(__BIG_ENDIAN)=0A= + u_int16_t dummy;=0A= +#endif=0A= u_int16_t port;=0A= } udp;=0A= struct {=0A= +#if defined(__BIG_ENDIAN)=0A= + u_int16_t dummy;=0A= +#endif=0A= u_int16_t id;=0A= } icmp;=0A= struct {=0A= @@ -50,12 +59,24 @@=0A= u_int64_t all;=0A= =0A= struct {=0A= +#if defined(__BIG_ENDIAN)=0A= + u_int32_t dummy32;=0A= + u_int16_t dummy16;=0A= +#endif=0A= u_int16_t port;=0A= } tcp;=0A= struct {=0A= +#if defined(__BIG_ENDIAN)=0A= + u_int32_t dummy32;=0A= + u_int16_t dummy16;=0A= +#endif=0A= u_int16_t port;=0A= } udp;=0A= struct {=0A= +#if defined(__BIG_ENDIAN)=0A= + u_int32_t dummy32;=0A= + u_int16_t dummy16;=0A= +#endif=0A= u_int8_t type, code;=0A= } icmp;=0A= struct {=0A= ------_=_NextPart_000_01C2C983.FD564AA9--