diff --git a/changes.txt b/changes.txt index 97583ab..d8d31d8 100644 --- a/changes.txt +++ b/changes.txt @@ -57,3 +57,7 @@ tpws : added split-pos option. split every message at specified position v11 ipset : scripts optimizations + +v12 + +nfqws : fix wrong tcp checksum calculation if packet length is odd and platform is big-endian diff --git a/nfq/nfqws.c b/nfq/nfqws.c index 83205bc..e244f17 100644 --- a/nfq/nfqws.c +++ b/nfq/nfqws.c @@ -125,8 +125,12 @@ uint16_t tcp_checksum(const void *buff, int len, in_addr_t src_addr, in_addr_t d len -= 2; } if ( len & 1 ) + { // Add the padding if the packet lenght is odd - sum += *((uint8_t *)buf); + uint16_t v=0; + *(uint8_t *)&v = *((uint8_t *)buf); + sum += v; + } // Add the pseudo-header sum += *(ip_src++); @@ -165,8 +169,12 @@ uint16_t tcp6_checksum(const void *buff, int len, const struct in6_addr *src_add len -= 2; } if ( len & 1 ) + { // Add the padding if the packet lenght is odd - sum += *((uint8_t *)buf); + uint16_t v=0; + *(uint8_t *)&v = *((uint8_t *)buf); + sum += v; + } // Add the pseudo-header sum += *(ip_src++); diff --git a/readme.txt b/readme.txt index 73a16c5..5682377 100644 --- a/readme.txt +++ b/readme.txt @@ -1,4 +1,4 @@ -zapret v.11 +zapret v.12 Для чего это надо -----------------