Re: [PATCH libnetfilter_queue 1/2] src: more IPv6 checksum fixes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Applied, thanks for fixing up this. Comment below.

On Fri, Dec 20, 2019 at 04:53:47PM +1100, Duncan Roe wrote:
> diff --git a/src/extra/checksum.c b/src/extra/checksum.c
> index 42389aa..8b23997 100644
> --- a/src/extra/checksum.c
> +++ b/src/extra/checksum.c
> @@ -62,21 +62,21 @@ uint16_t nfq_checksum_tcpudp_ipv6(struct ip6_hdr *ip6h, void *transport_hdr,
>  				  uint16_t protonum)
>  {
>  	uint32_t sum = 0;
> -	uint32_t hdr_len = (uint32_t *)transport_hdr - (uint32_t *)ip6h;
> -	uint32_t len = ip6h->ip6_plen - hdr_len;
> +	uint32_t hdr_len = (uint8_t *)transport_hdr - (uint8_t *)ip6h;
> +	/* Allow for extra headers before the UDP header */
> +	/* TODO: Deal with routing headers */
> +	uint32_t len = ntohs(ip6h->ip6_plen) - (hdr_len - sizeof *ip6h);
>  	uint8_t *payload = (uint8_t *)ip6h + hdr_len;
>  	int i;
>  
>  	for (i=0; i<8; i++) {
> -		sum += (ip6h->ip6_src.s6_addr16[i] >> 16) & 0xFFFF;
>  		sum += (ip6h->ip6_src.s6_addr16[i]) & 0xFFFF;

I think you can also send a follow up to clean up this: Remove the 0xFFFF.



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux