All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] netpoll endian fixes
@ 2004-09-07 23:24 Duncan Sands
  2004-09-07 23:29 ` Matt Mackall
  2004-09-07 23:57 ` Matt Mackall
  0 siblings, 2 replies; 8+ messages in thread
From: Duncan Sands @ 2004-09-07 23:24 UTC (permalink / raw)
  To: mpm; +Cc: linux-kernel@vger.kernel.org

The big-endians took their revenge in netpoll.c: on i386,
the ip header length / version nibbles need to be the other
way round; and the htonl leaves only zeros in tot_len...

All the best, 

Duncan.


--- linux-2.5/net/core/netpoll.c.orig	2004-09-08 01:15:22.000000000 +0200
+++ linux-2.5/net/core/netpoll.c	2004-09-08 01:05:33.000000000 +0200
@@ -22,6 +22,7 @@
 #include <net/tcp.h>
 #include <net/udp.h>
 #include <asm/unaligned.h>
+#include <asm/byteorder.h>
 
 /*
  * We maintain a small pool of fully-sized skbs, to make sure the
@@ -242,9 +243,13 @@
 	iph = (struct iphdr *)skb_push(skb, sizeof(*iph));
 
 	/* iph->version = 4; iph->ihl = 5; */
+#if defined(__LITTLE_ENDIAN_BITFIELD)
+	put_unaligned(0x45, (unsigned char *)iph);
+#else
 	put_unaligned(0x54, (unsigned char *)iph);
+#endif
 	iph->tos      = 0;
-	put_unaligned(htonl(ip_len), &(iph->tot_len));
+	put_unaligned(htons(ip_len), &(iph->tot_len));
 	iph->id       = 0;
 	iph->frag_off = 0;
 	iph->ttl      = 64;

^ permalink raw reply	[flat|nested] 8+ messages in thread
[parent not found: <77423609@toto.iv>]

end of thread, other threads:[~2004-09-09  9:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-07 23:24 [PATCH] netpoll endian fixes Duncan Sands
2004-09-07 23:29 ` Matt Mackall
2004-09-08  6:56   ` Duncan Sands
2004-09-07 23:57 ` Matt Mackall
2004-09-08 10:01   ` Duncan Sands
2004-09-08 22:53     ` Matt Mackall
2004-09-09  9:31       ` Duncan Sands
     [not found] <77423609@toto.iv>
2004-09-09  2:09 ` Peter Chubb

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.