[NET]: Fix UDP checksum issue in net poll mode.
authorAubrey.Li <aubreylee@gmail.com>
Tue, 17 Apr 2007 19:40:20 +0000 (12:40 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Tue, 17 Apr 2007 20:13:26 +0000 (13:13 -0700)
In net poll mode, 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 causing my test case failed. The following
patch fixed this issue.

Signed-off-by: Aubrey.Li <aubreylee@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/netpoll.c

index da1019451ccbe68185af1db8b7db3bb30a305c8f..4581ece48bb24e1308854525306ce4a86f92c56e 100644 (file)
@@ -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;