Index | Thread | Search

From:
Alexander Bluhm <bluhm@openbsd.org>
Subject:
Re: softlro: reduce max packet size by max_linkhdr
To:
Jan Klemkow <jan@openbsd.org>
Cc:
tech@openbsd.org
Date:
Tue, 5 Aug 2025 11:35:58 +0200

Download raw body.

Thread
On Mon, Aug 04, 2025 at 06:42:18PM +0200, Jan Klemkow wrote:
> Hi,
> 
> While debugging with stsp@, we figured out:
> SoftLRO produces to large packets in some corner cases.  The following
> diff reduces the max IP packet size by max_linkhdr as tcp_output() do.
> 
> ok?

Tested on ice(4) and ixl(4).

OK bluhm@

> Index: netinet/tcp_input.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet/tcp_input.c,v
> diff -u -p -r1.457 tcp_input.c
> --- netinet/tcp_input.c	24 Jul 2025 21:34:07 -0000	1.457
> +++ netinet/tcp_input.c	4 Aug 2025 16:35:28 -0000
> @@ -4385,7 +4385,7 @@ tcp_softlro_compare(struct ether_extract
>  			return 0;
>  
>  		/* Check max. IPv4 length. */
> -		if (head->iplen + tail->iplen > IP_MAXPACKET)
> +		if (head->iplen + tail->iplen > IP_MAXPACKET - max_linkhdr)
>  			return 0;
>  	} else if (head->ip6 && tail->ip6) {
>  		/* Check IPv6 addresses. */
> @@ -4397,7 +4397,7 @@ tcp_softlro_compare(struct ether_extract
>  
>  		/* Check max. IPv6 length. */
>  		if ((head->iplen - head->iphlen) +
> -		    (tail->iplen - tail->iphlen) > IPV6_MAXPACKET)
> +		    (tail->iplen - tail->iphlen) > IPV6_MAXPACKET - max_linkhdr)
>  			return 0;
>  	} else {
>  		/* Address family does not match. */