netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] {pktgen, xfrm} re-caculate IPv4 checksum after transformation
@ 2013-11-29  2:59 Fan Du
  2013-11-30 21:17 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Fan Du @ 2013-11-29  2:59 UTC (permalink / raw)
  To: steffen.klassert; +Cc: davem, netdev

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-11-30 21:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-29  2:59 [PATCH net] {pktgen, xfrm} re-caculate IPv4 checksum after transformation Fan Du
2013-11-30 21:17 ` David Miller

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).