[bug #54890] A problem with TCP_SNDLOWAT validation macro

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[bug #54890] A problem with TCP_SNDLOWAT validation macro

madhu
URL:
  <https://savannah.nongnu.org/bugs/?54890>

                 Summary: A problem with TCP_SNDLOWAT validation macro
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: paza
            Submitted on: Wed 24 Oct 2018 06:33:59 AM UTC
                Category: TCP
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
            lwIP version: git head

    _______________________________________________________

Details:

On src/core/init.c, line 308:
#if TCP_SNDLOWAT >= (0xFFFF - (4 * TCP_MSS))

This implicitly constrains TCP_MSS to be smaller than 4096, unless negative
value in the right-hand side of the expression is valid.

I think that if TCP_MSS may exceed 4096, the expression should be:
#if (TCP_SNDLOWAT + (4 * TCP_MSS)) >= 0xFFFF
This way, there is no question regarding constraints on TCP_MSS.

But if TCP_MSS may not exceed this 4096, a compilation-time error should be
raised in case that it does, for obvious reasons.




    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?54890>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #54890] A problem with TCP_SNDLOWAT validation macro

madhu
Follow-up Comment #1, bug #54890 (project lwip):

My calculation tells me this would limit TCP_MSS to 16kByte, not 4kByte. Is
this a problem in your application? I'm OK with adding a check for TCP_MSS to
be smaller than 16 kByte...

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?54890>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #54890] A problem with TCP_SNDLOWAT validation macro

madhu
Follow-up Comment #2, bug #54890 (project lwip):

You're right, my mistake, TCP_MSS can indeed be up to 16kB.
I'm having all kinds of problems :) But none directly related to the
constraint on TCP_MSS - While debugging, I stumbled upon this line, and the
implicit constrain confused me. This is why I think there should be a
validation on TCP_MSS value (beside preventing possible bugs). So if you could
add this check it would be great.


    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?54890>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #54890] A problem with TCP_SNDLOWAT validation macro

madhu
Update of bug #54890 (project lwip):

                  Status:                    None => Fixed                  
             Assigned to:                    None => goldsimon              
             Open/Closed:                    Open => Closed                

    _______________________________________________________

Follow-up Comment #3:

Added a check for TCP_MSS to be <= ~ 16KByte

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?54890>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel