* udp checksum issue in netpoll mode.
@ 2007-04-12 10:31 Aubrey Li
2007-04-12 14:49 ` Stephen Hemminger
0 siblings, 1 reply; 3+ messages in thread
From: Aubrey Li @ 2007-04-12 10:31 UTC (permalink / raw)
To: Stephen Hemminger, Herbert Xu, Matt Mackall; +Cc: netdev, Linux Kernel
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
===============================================
static __sum16 checksum_udp(struct sk_buff *skb, struct udphdr *uh,
unsigned short ulen, __be32 saddr, __be32 daddr)
{
__wsum psum;
if (uh->check == 0 || skb->ip_summed == CHECKSUM_UNNECESSARY)
return 0;
psum = csum_tcpudp_nofold(saddr, daddr, ulen, IPPROTO_UDP, 0);
if (skb->ip_summed == CHECKSUM_COMPLETE &&
!csum_fold(csum_add(psum, skb->csum)))
return 0;
skb->csum = psum;
return __skb_checksum_complete(skb);
}
===============================================
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: udp checksum issue in netpoll mode.
2007-04-12 10:31 udp checksum issue in netpoll mode Aubrey Li
@ 2007-04-12 14:49 ` Stephen Hemminger
2007-04-16 10:02 ` Aubrey Li
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2007-04-12 14:49 UTC (permalink / raw)
To: Aubrey Li; +Cc: Herbert Xu, Matt Mackall, netdev, Linux Kernel
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).
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: udp checksum issue in netpoll mode.
2007-04-12 14:49 ` Stephen Hemminger
@ 2007-04-16 10:02 ` Aubrey Li
0 siblings, 0 replies; 3+ messages in thread
From: Aubrey Li @ 2007-04-16 10:02 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Herbert Xu, Matt Mackall, netdev, Linux Kernel
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-04-16 10:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-12 10:31 udp checksum issue in netpoll mode Aubrey Li
2007-04-12 14:49 ` Stephen Hemminger
2007-04-16 10:02 ` Aubrey Li
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).