|
@@ -8,7 +8,7 @@
|
|
|
#include <arpa/inet.h>
|
|
|
#include <netinet/ip.h>
|
|
|
#include <netinet/ip6.h>
|
|
|
-@@ -26,8 +27,13 @@ uint16_t nfq_checksum(uint32_t sum, uint16_t *buf, int size)
|
|
|
+@@ -26,8 +27,13 @@ uint16_t nfq_checksum(uint32_t sum, uint
|
|
|
sum += *buf++;
|
|
|
size -= sizeof(uint16_t);
|
|
|
}
|
|
@@ -24,7 +24,7 @@
|
|
|
|
|
|
sum = (sum >> 16) + (sum & 0xffff);
|
|
|
sum += (sum >>16);
|
|
|
-@@ -35,7 +41,7 @@ uint16_t nfq_checksum(uint32_t sum, uint16_t *buf, int size)
|
|
|
+@@ -35,7 +41,7 @@ uint16_t nfq_checksum(uint32_t sum, uint
|
|
|
return (uint16_t)(~sum);
|
|
|
}
|
|
|
|
|
@@ -33,7 +33,7 @@
|
|
|
{
|
|
|
uint32_t sum = 0;
|
|
|
uint32_t iph_len = iph->ihl*4;
|
|
|
-@@ -46,13 +52,13 @@ uint16_t nfq_checksum_tcpudp_ipv4(struct iphdr *iph)
|
|
|
+@@ -46,13 +52,13 @@ uint16_t nfq_checksum_tcpudp_ipv4(struct
|
|
|
sum += (iph->saddr) & 0xFFFF;
|
|
|
sum += (iph->daddr >> 16) & 0xFFFF;
|
|
|
sum += (iph->daddr) & 0xFFFF;
|
|
@@ -49,7 +49,7 @@
|
|
|
{
|
|
|
uint32_t sum = 0;
|
|
|
uint32_t hdr_len = (uint32_t *)transport_hdr - (uint32_t *)ip6h;
|
|
|
-@@ -68,7 +74,7 @@ uint16_t nfq_checksum_tcpudp_ipv6(struct ip6_hdr *ip6h, void *transport_hdr)
|
|
|
+@@ -68,7 +74,7 @@ uint16_t nfq_checksum_tcpudp_ipv6(struct
|
|
|
sum += (ip6h->ip6_dst.s6_addr16[i] >> 16) & 0xFFFF;
|
|
|
sum += (ip6h->ip6_dst.s6_addr16[i]) & 0xFFFF;
|
|
|
}
|
|
@@ -58,11 +58,9 @@
|
|
|
sum += htons(ip6h->ip6_plen);
|
|
|
|
|
|
return nfq_checksum(sum, (uint16_t *)payload, len);
|
|
|
-diff --git a/src/extra/tcp.c b/src/extra/tcp.c
|
|
|
-index d1cd79d..a66f392 100644
|
|
|
--- a/src/extra/tcp.c
|
|
|
+++ b/src/extra/tcp.c
|
|
|
-@@ -96,7 +96,7 @@ nfq_tcp_compute_checksum_ipv4(struct tcphdr *tcph, struct iphdr *iph)
|
|
|
+@@ -96,7 +96,7 @@ nfq_tcp_compute_checksum_ipv4(struct tcp
|
|
|
{
|
|
|
/* checksum field in header needs to be zero for calculation. */
|
|
|
tcph->check = 0;
|
|
@@ -71,7 +69,7 @@ index d1cd79d..a66f392 100644
|
|
|
}
|
|
|
EXPORT_SYMBOL(nfq_tcp_compute_checksum_ipv4);
|
|
|
|
|
|
-@@ -110,7 +110,7 @@ nfq_tcp_compute_checksum_ipv6(struct tcphdr *tcph, struct ip6_hdr *ip6h)
|
|
|
+@@ -110,7 +110,7 @@ nfq_tcp_compute_checksum_ipv6(struct tcp
|
|
|
{
|
|
|
/* checksum field in header needs to be zero for calculation. */
|
|
|
tcph->check = 0;
|
|
@@ -82,7 +80,7 @@ index d1cd79d..a66f392 100644
|
|
|
|
|
|
--- a/src/extra/udp.c
|
|
|
+++ b/src/extra/udp.c
|
|
|
-@@ -96,7 +96,7 @@ nfq_udp_compute_checksum_ipv4(struct udphdr *udph, struct iphdr *iph)
|
|
|
+@@ -96,7 +96,7 @@ nfq_udp_compute_checksum_ipv4(struct udp
|
|
|
{
|
|
|
/* checksum field in header needs to be zero for calculation. */
|
|
|
udph->check = 0;
|
|
@@ -91,7 +89,7 @@ index d1cd79d..a66f392 100644
|
|
|
}
|
|
|
EXPORT_SYMBOL(nfq_udp_compute_checksum_ipv4);
|
|
|
|
|
|
-@@ -115,7 +115,7 @@ nfq_udp_compute_checksum_ipv6(struct udphdr *udph, struct ip6_hdr *ip6h)
|
|
|
+@@ -115,7 +115,7 @@ nfq_udp_compute_checksum_ipv6(struct udp
|
|
|
{
|
|
|
/* checksum field in header needs to be zero for calculation. */
|
|
|
udph->check = 0;
|