mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Aubrey Li" <aubreylee@gmail.com>
To: "Stephen Hemminger" <shemminger@linux-foundation.org>
Cc: "Herbert Xu" <herbert@gondor.apana.org.au>,
	"Matt Mackall" <mpm@selenic.com>,
	netdev@vger.kernel.org,
	"Linux Kernel" <linux-kernel@vger.kernel.org>
Subject: Re: udp checksum issue in netpoll mode.
Date: Mon, 16 Apr 2007 18:02:09 +0800	[thread overview]
Message-ID: <6d6a94c50704160302n14f8bf14l3c9f2a380f74dd3f@mail.gmail.com> (raw)
In-Reply-To: <461E470B.5060907@linux-foundation.org>

On 4/12/07, Stephen Hemminger <shemminger@linux-foundation.org> wrote:
> Aubrey Li wrote:
> > I think we discussed this issue before.
> >
> > The current checksum function doesn't consider the kind of packet
> > which is padded to reach a specific minimum length. I believe that's
> > the problem caused my test case failed. Is this issue fixed? Or is it
> > acceptable if I make a patch not calculating this kind of packet?
> >
> > Thanks,
> > -Aubrey
> The caller should be trimming the packet and updating the hardware checksum
> value (like the normal UDP path).
>
OK, the following patch fixed the problem.

Signed-off-by: Aubrey.Li <aubreylee@gmail.com>
---
 net/core/netpoll.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 823215d..522e441 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -471,6 +471,13 @@ int __netpoll_rx(struct sk_buff *skb)
 	if (skb->len < len || len < iph->ihl*4)
 		goto out;

+	/*
+	 * Our transport medium may have padded the buffer out.
+	 * Now We trim to the true length of the frame.
+	 */
+	if (pskb_trim_rcsum(skb, len))
+		goto out;
+
 	if (iph->protocol != IPPROTO_UDP)
 		goto out;

-- 
1.5.1

      reply	other threads:[~2007-04-16 10:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-12 10:31 Aubrey Li
2007-04-12 14:49 ` Stephen Hemminger
2007-04-16 10:02   ` Aubrey Li [this message]

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=6d6a94c50704160302n14f8bf14l3c9f2a380f74dd3f@mail.gmail.com \
    --to=aubreylee@gmail.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.com \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@linux-foundation.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

all inboxes | Powered by JetHome®