From: Fan Du <fan.du@windriver.com>
To: <steffen.klassert@secunet.com>
Cc: <davem@davemloft.net>, <netdev@vger.kernel.org>
Subject: [PATCH net] {pktgen, xfrm} re-caculate IPv4 checksum after transformation
Date: Fri, 29 Nov 2013 10:59:09 +0800 [thread overview]
Message-ID: <1385693949-3786-1-git-send-email-fan.du@windriver.com> (raw)
I accidently observed incorrect IPv4 checksum by wireshark
when armming pktgen with IPsec by ESP transport mode with
following pktgen configuration:
pgset "flag IPSEC"
pgset "flows 1"
It seems that after transformation, IPv4 checksum remains the
origianl checksum as before, so encrypted packet will never
reach receiver's upper layer because of wrong IPv4 checksum
value.
Fix this by re-caculate checksum value.
Signed-off-by: Fan Du <fan.du@windriver.com>
---
net/core/pktgen.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 261357a..8d13b41 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2786,6 +2786,8 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
#ifdef CONFIG_XFRM
if (!process_ipsec(pkt_dev, skb, protocol))
return NULL;
+ iph = ip_hdr(skb);
+ ip_send_check(iph);
#endif
return skb;
--
1.7.9.5
next reply other threads:[~2013-11-29 2:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-29 2:59 Fan Du [this message]
2013-11-30 21:17 ` [PATCH net] {pktgen, xfrm} re-caculate IPv4 checksum after transformation David Miller
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=1385693949-3786-1-git-send-email-fan.du@windriver.com \
--to=fan.du@windriver.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=steffen.klassert@secunet.com \
/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).