[3.8.y.z extended stable] Patch "{pktgen, xfrm} Update IPv4 header total len and checksum after" has been added to staging queue
Kamal Mostafa
kamal at canonical.com
Wed Dec 11 20:09:41 UTC 2013
This is a note to let you know that I have just added a patch titled
{pktgen, xfrm} Update IPv4 header total len and checksum after
to the linux-3.8.y-queue branch of the 3.8.y.z extended stable tree
which can be found at:
http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.8.y-queue
This patch is scheduled to be released in version 3.8.13.15.
If you, or anyone else, feels it should not be added to this tree, please
reply to this email.
For more information about the 3.8.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable
Thanks.
-Kamal
------
>From 0cac844ed50c3e250dc52c80d6fa56a9d485bf83 Mon Sep 17 00:00:00 2001
From: "fan.du" <fan.du at windriver.com>
Date: Sun, 1 Dec 2013 16:28:48 +0800
Subject: {pktgen, xfrm} Update IPv4 header total len and checksum after
tranformation
[ Upstream commit 3868204d6b89ea373a273e760609cb08020beb1a ]
commit a553e4a6317b2cfc7659542c10fe43184ffe53da ("[PKTGEN]: IPSEC support")
tried to support IPsec ESP transport transformation for pktgen, but acctually
this doesn't work at all for two reasons(The orignal transformed packet has
bad IPv4 checksum value, as well as wrong auth value, reported by wireshark)
- After transpormation, IPv4 header total length needs update,
because encrypted payload's length is NOT same as that of plain text.
- After transformation, IPv4 checksum needs re-caculate because of payload
has been changed.
With this patch, armmed pktgen with below cofiguration, Wireshark is able to
decrypted ESP packet generated by pktgen without any IPv4 checksum error or
auth value error.
pgset "flag IPSEC"
pgset "flows 1"
Signed-off-by: Fan Du <fan.du at windriver.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
---
net/core/pktgen.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index e6e1cbe..3659f1e 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2503,6 +2503,8 @@ static int process_ipsec(struct pktgen_dev *pkt_dev,
if (x) {
int ret;
__u8 *eth;
+ struct iphdr *iph;
+
nhead = x->props.header_len - skb_headroom(skb);
if (nhead > 0) {
ret = pskb_expand_head(skb, nhead, 0, GFP_ATOMIC);
@@ -2524,6 +2526,11 @@ static int process_ipsec(struct pktgen_dev *pkt_dev,
eth = (__u8 *) skb_push(skb, ETH_HLEN);
memcpy(eth, pkt_dev->hh, 12);
*(u16 *) ð[12] = protocol;
+
+ /* Update IPv4 header len as well as checksum value */
+ iph = ip_hdr(skb);
+ iph->tot_len = htons(skb->len - ETH_HLEN);
+ ip_send_check(iph);
}
}
return 1;
--
1.8.3.2
More information about the kernel-team
mailing list