aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/pktgen.c
diff options
context:
space:
mode:
authorfan.du <fan.du@windriver.com>2013-12-01 16:28:48 +0800
committerBen Hutchings <ben@decadent.org.uk>2014-01-03 04:33:34 +0000
commitebca8c26fb22fca588fdcf5e5baa409da399247f (patch)
treea29646e107cb7dc9adf531a905a4cce72e1aa516 /net/core/pktgen.c
parent24e3644c3770b8b5914cd4e13c5594c41bb0d791 (diff)
downloadkernel_samsung_smdk4412-ebca8c26fb22fca588fdcf5e5baa409da399247f.zip
kernel_samsung_smdk4412-ebca8c26fb22fca588fdcf5e5baa409da399247f.tar.gz
kernel_samsung_smdk4412-ebca8c26fb22fca588fdcf5e5baa409da399247f.tar.bz2
{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@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'net/core/pktgen.c')
-rw-r--r--net/core/pktgen.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 2ef7da0..80aeac9 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2524,6 +2524,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);
@@ -2545,6 +2547,11 @@ static int process_ipsec(struct pktgen_dev *pkt_dev,
eth = (__u8 *) skb_push(skb, ETH_HLEN);
memcpy(eth, pkt_dev->hh, 12);
*(u16 *) &eth[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;