On Fri, May 19, 2023 at 07:58:47PM +0200, Jan Klemkow wrote: > Hi, > > We use the wrong interface and mtu in tcp_mss() to calculate the mss if > the destination address points is a local address. In ip_output() we > use the correct interface and its mtu. > > This limits the mss to 1448 if the mtu of the interface it 1500, > instead of using a local 32k mss. > > The bigger issue is: local bulk traffic with the current TSO > implementation is broken. tcp_output() creates TSO packets with an mss > smaller then 32k and ip_output() calls if_output instead of > tcp_if_output_tso() because it fits into the mtu check of lo0. > > This diff takes the same logic to pick the interface in tcp_mss() as its > done in ip_output() and fixes both issues. > > ok?
I'm fine with this going in since it emulates the same behaviour as ip_output. For the curious ip6_output() seems to have the same workaround. Now in an ideal world the other issue exposed by this mtu mismatch should also be fixed. We had similar issues with TCP over loopback on multiple occasions. So maybe it is time to fix this for good. Note: In an ideal world lo(4) would do TSO and LRO since it bounces the packet right back at us. > Index: netinet/tcp_input.c > =================================================================== > RCS file: /cvs/src/sys/netinet/tcp_input.c,v > retrieving revision 1.387 > diff -u -p -r1.387 tcp_input.c > --- netinet/tcp_input.c 14 Mar 2023 00:24:05 -0000 1.387 > +++ netinet/tcp_input.c 19 May 2023 17:22:47 -0000 > @@ -2805,7 +2805,11 @@ tcp_mss(struct tcpcb *tp, int offer) > if (rt == NULL) > goto out; > > - ifp = if_get(rt->rt_ifidx); > + if (ISSET(rt->rt_flags, RTF_LOCAL)) > + ifp = if_get(rtable_loindex(inp->inp_rtableid)); > + else > + ifp = if_get(rt->rt_ifidx); > + > if (ifp == NULL) > goto out; > > -- :wq Claudio