netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Lalancette <clalance@redhat.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: Zero checksum in netconsole/netdump packets
Date: Tue, 07 Nov 2006 08:33:00 -0500	[thread overview]
Message-ID: <45508B0C.5020109@redhat.com> (raw)
In-Reply-To: <20061106.231603.15264009.davem@davemloft.net>

[-- Attachment #1: Type: text/plain, Size: 645 bytes --]

David Miller wrote:
> From: Chris Lalancette <clalance@redhat.com>
> Date: Mon, 06 Nov 2006 18:40:59 -0500
> 
>>      Assuming that this is just an oversight, attached is a simple
>>      patch to compute the UDP checksum in netpoll_send_udp.
> 
> If the resulting checksum is zero, you should set it to
> all 1's, like the real UDP code does.

David,
     Ah, thanks.  Forgot about that.  I re-spun the patch with the change (attached).  I also moved the UDP checksum calculation up to where the rest of the UDP header setup is, to make it more consistent.

Thanks again for the comments!

Signed-off-by: Chris Lalancette <clalance@redhat.com>

[-- Attachment #2: linux-2.6.19-rc4-netpoll-udp-checksum.patch --]
[-- Type: text/x-patch, Size: 576 bytes --]

--- linux-2.6/net/core/netpoll.c.orig	2006-11-06 18:16:58.000000000 -0500
+++ linux-2.6/net/core/netpoll.c	2006-11-07 08:16:29.000000000 -0500
@@ -340,6 +340,12 @@ void netpoll_send_udp(struct netpoll *np
 	udph->dest = htons(np->remote_port);
 	udph->len = htons(udp_len);
 	udph->check = 0;
+	udph->check = csum_tcpudp_magic(htonl(np->local_ip),
+					htonl(np->remote_ip),
+					udp_len, IPPROTO_UDP,
+					csum_partial((unsigned char *)udph, udp_len, 0));
+	if (udph->check == 0)
+		udph->check = -1;
 
 	skb->nh.iph = iph = (struct iphdr *)skb_push(skb, sizeof(*iph));
 

  reply	other threads:[~2006-11-07 13:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-06 23:40 Zero checksum in netconsole/netdump packets Chris Lalancette
2006-11-07  7:16 ` David Miller
2006-11-07 13:33   ` Chris Lalancette [this message]
2006-11-07 22:56     ` David Miller
2006-11-07 10:09 ` Gerrit Renker
2006-11-07 11:35   ` Krzysztof Oledzki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45508B0C.5020109@redhat.com \
    --to=clalance@redhat.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).