From 38a7e5b365edce1fc0a972a05bbda0673ca63cad Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Mon, 30 Sep 2019 16:25:42 +0200 Subject: checksum: Fix UDP checksum calculation The level 4 protocol is part of the UDP and TCP calculations. nfq_checksum_tcpudp_ipv4() was using IPPROTO_TCP in this calculation, which gave the wrong answer for UDP. Based on patch from Alin Nastac, and patch description from Duncan Roe. Signed-off-by: Pablo Neira Ayuso --- src/internal.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/internal.h') diff --git a/src/internal.h b/src/internal.h index 558d267..d648bfe 100644 --- a/src/internal.h +++ b/src/internal.h @@ -15,8 +15,9 @@ struct iphdr; struct ip6_hdr; uint16_t nfq_checksum(uint32_t sum, uint16_t *buf, int size); -uint16_t nfq_checksum_tcpudp_ipv4(struct iphdr *iph); -uint16_t nfq_checksum_tcpudp_ipv6(struct ip6_hdr *ip6h, void *transport_hdr); +uint16_t nfq_checksum_tcpudp_ipv4(struct iphdr *iph, uint16_t protonum); +uint16_t nfq_checksum_tcpudp_ipv6(struct ip6_hdr *ip6h, void *transport_hdr, + uint16_t protonum); struct pkt_buff { uint8_t *mac_header; -- cgit v1.2.3