• fan.du's avatar
    {pktgen, xfrm} Update IPv4 header total len and checksum after tranformation · 83fc70f4
    fan.du authored
    [ Upstream commit 3868204d ]
    
    commit a553e4a6 ("[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: default avatarFan Du <fan.du@windriver.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    83fc70f4
pktgen.c 91.5 KB