From 07a17f67f77d961fa69061116b680e1158cb3528 Mon Sep 17 00:00:00 2001 From: Darrell Ball Date: Mon, 25 Feb 2019 15:07:00 -0800 Subject: [PATCH] conntrack: Fix L4 csum for V6 extension hdr pkts. It is a day one issue that got copied to subsequent code. Fixes: a489b16854b5 ("conntrack: New userspace connection tracker.") CC: Daniele Di Proietto Signed-off-by: Darrell Ball Signed-off-by: Ben Pfaff --- lib/conntrack.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/conntrack.c b/lib/conntrack.c index 1917fd8d9e3..2f2e6a37235 100644 --- a/lib/conntrack.c +++ b/lib/conntrack.c @@ -603,19 +603,14 @@ static inline bool checksum_valid(const struct conn_key *key, const void *data, size_t size, const void *l3) { - uint32_t csum = 0; - if (key->dl_type == htons(ETH_TYPE_IP)) { - csum = packet_csum_pseudoheader(l3); + uint32_t csum = packet_csum_pseudoheader(l3); + return csum_finish(csum_continue(csum, data, size)) == 0; } else if (key->dl_type == htons(ETH_TYPE_IPV6)) { - csum = packet_csum_pseudoheader6(l3); + return packet_csum_upperlayer6(l3, data, key->nw_proto, size) == 0; } else { return false; } - - csum = csum_continue(csum, data, size); - - return csum_finish(csum) == 0; } static inline bool