From: Jan Klemkow Subject: Re: tcp softlro ethernet padding To: Alexander Bluhm Cc: tech@openbsd.org Date: Mon, 28 Apr 2025 22:24:55 +0200 On Mon, Apr 28, 2025 at 09:04:44PM +0200, Alexander Bluhm wrote: > Back then when I was debugging ix(4) LRO, I found that the RX mbuf > returned from the driver may contain ethernet padding. My tests > did not see this behavior with ixl(4) hardware. But inserting > ethernet padding into a TCP stream would be completely wrong, so I > suggest adding this sanity check. > > ok? ok jan > Index: netinet/tcp_input.c > =================================================================== > RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/tcp_input.c,v > diff -u -p -r1.440 tcp_input.c > --- netinet/tcp_input.c 23 Apr 2025 17:52:12 -0000 1.440 > +++ netinet/tcp_input.c 28 Apr 2025 18:57:48 -0000 > @@ -4453,6 +4453,18 @@ tcp_softlro_glue(struct mbuf_list *ml, s > goto out; > > ether_extract_headers(mtail, &tail); > + > + if (tail.tcp) { > + int tcpdatalen; > + > + /* Remove possible ethernet padding at the end. */ > + tcpdatalen = tail.iplen - tail.iphlen - tail.tcphlen; > + if (tcpdatalen < tail.paylen ) { > + m_adj(mtail, tcpdatalen - tail.paylen); > + tail.paylen = tcpdatalen; > + } > + } > + > if (!tcp_softlro_check(mtail, &tail)) { > mtail->m_pkthdr.ph_mss = 0; > goto out; >