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?

bye,
Jan

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;
 

Reply via email to