lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #35945] SYN packet should provide the recv MSS not the


From: Mason
Subject: [lwip-devel] [bug #35945] SYN packet should provide the recv MSS not the send MSS
Date: Thu, 22 Mar 2012 12:32:36 +0000
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko/20120312 Firefox/11.0 SeaMonkey/2.8

URL:
  <http://savannah.nongnu.org/bugs/?35945>

                 Summary: SYN packet should provide the recv MSS not the send
MSS
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: mason
            Submitted on: Thu 22 Mar 2012 12:32:35 PM GMT
                Category: TCP
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 
            lwIP version: 1.4.0

    _______________________________________________________

Details:

The fix
<http://git.savannah.gnu.org/cgit/lwip.git/commit/?id=d96703bba35c16e6fb9b4ee40d02344c0ee165a3>
for bug #34587 <https://savannah.nongnu.org/bugs/?34587> is incorrect.

As noted in RFC 879 <https://tools.ietf.org/html/rfc879>:

  The MSS can be used completely independently in each direction of
  data flow.  The result may be quite different maximum sizes in the
  two directions.


Currently, lwip confuses the recv MSS with the send MSS
(pcb->mss is the send MSS; I don't think we keep track of
the recv MSS right now, since it's only needed for the SYN)

Basically,
recv_MSS = MIN(TCP_MSS, MTU(link) - 40)
send_MSS = MIN(576, MTU(link)) - 40

send_MSS must be more conservative than recv_MSS, as we must assume that
the distant host cannot process datagrams larger than 576 in IPv4.
(NB: the value is 1280 in IPv6).

The problem is that I don't see an easy way in tcp_output_segment
to get the MTU of the output link...

Proposed patch to illustrate my comment:

--- tcp_out.c   2012-02-23 10:57:12.859375000 +0100
+++ tcp_out.c   2012-03-22 13:24:35.609375000 +0100
@@ -1066,7 +1066,13 @@
      packets, so ignore it here */
   opts = (u32_t *)(void *)(seg->tcphdr + 1);
   if (seg->flags & TF_SEG_OPTS_MSS) {
-    *opts = TCP_BUILD_MSS_OPTION(pcb->mss);
+    int mss = TCP_MSS;
+#if 0
+    // Should we use tcp_eff_send_mss?
+    // We want the same code, but the name would be confusing.
+    mss = MIN(TCP_MSS, MTU_OF_OUTPUT_LINK - 40);
+#endif
+    *opts = TCP_BUILD_MSS_OPTION(mss);
     opts += 1;
   }
 #if LWIP_TCP_TIMESTAMPS


Comments? Thoughts?

cf. also this discussion
<https://lists.gnu.org/archive/html/lwip-users/2012-03/msg00092.html>





    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?35945>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]