buglwIP - A Lightweight TCP/IP stack - Bugs: bug #51528, Bug when parsing WND_SCALE option

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #51528: Bug when parsing WND_SCALE option

Submitted by:  Pascal Quantin <pquantin>
Submitted on:  Fri 21 Jul 2017 03:32:43 PM UTC  
 
Category: TCPSeverity: 3 - Normal
Item Group: Faulty BehaviourStatus: Fixed
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned Release: None
lwIP version: 2.0.2

Mon 24 Jul 2017 07:39:31 PM UTC, comment #1:

Fixed, thanks for reporting!

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Fri 21 Jul 2017 03:32:43 PM UTC, original submission:

With the current source code, when parsing the WND_SCALE, the window scaling byte is only read if the current packet is a SYN one and not a retransmission:

/* If syn was received with wnd scale option,
activate wnd scale opt, but only if this is not a retransmission */
if ((flags & TCP_SYN) && !(pcb->flags & TF_WND_SCALE)) {
/* An WND_SCALE option with the right option length. */
data = tcp_getoptbyte();

But the data byte should always be read, even in case of TCP retransmission. Otherwise tcp_optidx is not incremented and it breaks the rest of the options parsing.

The proposed patch below solves my issue:

diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index ba879284..93a07678 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -1749,11 +1749,11 @@ tcp_parseopt(struct tcp_pcb *pcb)
LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_parseopt: bad length\n"));
return;
}
+ data = tcp_getoptbyte();
/* If syn was received with wnd scale option,
activate wnd scale opt, but only if this is not a retransmission */
if ((flags & TCP_SYN) && !(pcb->flags & TF_WND_SCALE)) {
/* An WND_SCALE option with the right option length. */
- data = tcp_getoptbyte();
pcb->snd_scale = data;
if (pcb->snd_scale > 14U) {
pcb->snd_scale = 14U;

Pascal Quantin <pquantin>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by goldsimon (Posted a comment)
  • -unavailable- added by pquantin (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 24 Jul 2017 07:39:31 PM UTCgoldsimonStatusNone=>Fixed
      Assigned toNone=>goldsimon
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1