path: root/src/internal.h
diff options
authorPablo Neira Ayuso <>2019-09-30 16:25:42 +0200
committerPablo Neira Ayuso <>2019-09-30 16:26:29 +0200
commit38a7e5b365edce1fc0a972a05bbda0673ca63cad (patch)
treebd7568505a14739910dc8c09faaeffde2bac869b /src/internal.h
parent601abd1c71ccdf90753cf294c120ad43fb25dc54 (diff)
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 <>
Diffstat (limited to 'src/internal.h')
1 files changed, 3 insertions, 2 deletions
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;