Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S268750AbUIGXZM (ORCPT ); Tue, 7 Sep 2004 19:25:12 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S268767AbUIGXZL (ORCPT ); Tue, 7 Sep 2004 19:25:11 -0400 Received: from postfix4-1.free.fr ([213.228.0.62]:15574 "EHLO postfix4-1.free.fr") by vger.kernel.org with ESMTP id S268750AbUIGXYp (ORCPT ); Tue, 7 Sep 2004 19:24:45 -0400 From: Duncan Sands To: mpm@selenic.com Subject: [PATCH] netpoll endian fixes Date: Wed, 8 Sep 2004 01:24:43 +0200 User-Agent: KMail/1.6.2 Cc: "linux-kernel@vger.kernel.org" MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200409080124.43530.baldrick@free.fr> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1223 Lines: 39 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 #include #include +#include /* * 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; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/