netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yongjun <yjwei@nanjing-fnst.com>
To: netdev@vger.kernel.org
Subject: [PATCH] Bug in pskb_trim_rcsum()
Date: Sun, 16 Jul 2006 23:53:20 -0400	[thread overview]
Message-ID: <1153108401.3651.9.camel@LINE> (raw)

  Since network device can auto calculate and verify the checksum of a
packet, for example: some e1000 interface. Different device will set
different value of skb->ip_summed.
  a) If device do nothing to checksum, skb->ip_summed would be set to
CHECKSUM_NONE.
  b) If device can only calculate a checksum, and the checksum is
correct, skb->ip_summed would be set to CHECKSUM_HW.
  c) If device can verify the checksum, and the checksum is correct,
skb->ip_summed would be set to CHECKSUM_UNNECESSARY.
  So if I want to trim a skb, I think I must do a checksum even if the
skb->ip_summed is CHECKSUM_UNNECESSARY.

Following is the comment about CHECKSUM_UNNECESSARY in
include/linux/skbuff.h:
 *	UNNECESSARY: device parsed packet and wouldbe verified checksum.
 *		skb->csum is undefined.
 *	      It is bad option, but, unfortunately, many of vendors do this.
 *	      Apparently with secret goal to sell you new device, when you
 *	      will add new protocol to your host. F.e. IPv6. 8)

Signed-off-by: Wei Yongjun <weiyj@soft.fujitsu.com>


--- a/include/linux/skbuff.h	2006-07-17 10:14:23.175070472 -0400
+++ b/include/linux/skbuff.h	2006-07-17 10:18:31.762279472 -0400
@@ -1208,8 +1208,8 @@ static inline int pskb_trim_rcsum(struct
 {
 	if (likely(len >= skb->len))
 		return 0;
-	if (skb->ip_summed == CHECKSUM_HW)
-		skb->ip_summed = CHECKSUM_NONE;
+
+	skb->ip_summed = CHECKSUM_NONE;
 	return __pskb_trim(skb, len);
 }
 



             reply	other threads:[~2006-07-17  2:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-17  3:53 Wei Yongjun [this message]
2006-07-17 12:17 ` [PATCH] Bug in pskb_trim_rcsum() Herbert Xu
     [not found]   ` <006201c6aa06$d51581c0$6004a8c0@WeiYongjun>
2006-07-18 11:32     ` Herbert Xu
2006-07-18 12:54       ` Alexey Kuznetsov
2006-07-18 13:04         ` Herbert Xu
2006-07-25  6:36           ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2006-07-18  2:26 Wei Yongjun

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=1153108401.3651.9.camel@LINE \
    --to=yjwei@nanjing-fnst.com \
    --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).