buglwIP - A Lightweight TCP/IP stack - Bugs: bug #37969, SYN packet dropped as short packet...

 
 

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

bug #37969: SYN packet dropped as short packet in tcp_input function

Submitted by:  Riccardo Manfrin <riccardomanfrin>
Submitted on:  Fri 21 Dec 2012 12:56:02 PM UTC  
 
Category: TCPSeverity: 3 - Normal
Item Group: Faulty BehaviourStatus: Fixed
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned Release: None
lwIP version: git head

Tue 03 Jun 2014 07:10:01 PM UTC, comment #4:

Fixed by also parsing options when they are splitted into 2 pbufs (the tcp header still must be in one contiguous memory block).

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Fri 11 Jan 2013 09:19:40 PM UTC, comment #3:

Thanks for the info. I've tested it with "PBUF_POOL_BUFSIZE 64" and also got no connection.

lwIP makes the assumption that all IP/TCP/UDP headers must fit into the first pbuf. With modern TCP implementations and a pbuf size of 64 bytes, this is obviously not the case (since many TCP options can make the TCP header quite big). I guess we'll have to fix that...

As a workaround, you could use "PBUF_POOL_BUFSIZE 128"...

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Thu 27 Dec 2012 02:50:42 PM UTC, comment #2:

Sorry for the late reply (Xmas holidays)... I have not a clear idea on where to look for in order to answer your question: whay I presume could be an answer is the lwipopt.h file which follows:

#define MEM_ALIGNMENT 4
#define NO_SYS 1
#define ETHARP_TMR_INTERVAL 5000
#define LWIP_TIMEVAL_PRIVATE 0
#define LWIP_SOCKET 1
#define LWIP_NETCONN 1
#define LWIP_ARP 1
#define PBUF_POOL_SIZE 16
#define PBUF_POOL_BUFSIZE 64
#define IP_REASS_BUFSIZE 600
#define TCP_LISTEN_BACKLOG 1
#define LWIP_RAW 1

Does this provide your requested information?
Thanks in advance
R

Riccardo Manfrin <riccardomanfrin>
Fri 21 Dec 2012 04:13:04 PM UTC, comment #1:

In general, the headers are supposed to fit into the first pbuf. But I think for PBUF_POOL (which is normally used for RX), it should still work with the first pbuf containing 44 bytes only.

What pbuf type are you using for RX data and what is your allocation strategy?

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Fri 21 Dec 2012 12:56:02 PM UTC, original submission:

I'm integrating lwIP 1.4.0 in a NXP LPC cortex m3. I'm not using an operating system.

I'm experiencing a drop on TCP SYN packets in tcp_input.c at this point (in tcp_input function):

/* Move the payload pointer in the pbuf so that it points to the
TCP data instead of the TCP header. */
hdrlen = TCPH_HDRLEN(tcphdr);
if(pbuf_header(p, -(hdrlen * 4))){
/* drop short packets */
LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: short packetn"));
TCP_STATS_INC(tcp.lenerr);
TCP_STATS_INC(tcp.drop);
snmp_inc_tcpinerrs();
pbuf_free(p);
return;
}

In short the (increment_magnitude <= p->len) check fails as the increment is by 40 bytes and p->len is 30. Actually, the packet is 40 bytes long but splitted in to pbufs chunks (30+10).

I wonder if this is the usual way of processing the SYN but I would expect the SYN/ACK message to be sent in these cases.

As I drop the packet, the accept callback is not invoked and consequently I cannot enstablish the TCP connection.

Regards,
Riccardo Manfrin

Riccardo Manfrin <riccardomanfrin>

 

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 riccardomanfrin (Submitted the item)
  • -unavailable- added by riccardomanfrin
  •  

    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 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 03 Jun 2014 07:10:01 PM UTCgoldsimonStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Fri 11 Jan 2013 09:19:40 PM UTCgoldsimonStatusNeed Info=>Confirmed
      Assigned toNone=>goldsimon
      Planned Release=>1.5.0
    Fri 21 Dec 2012 04:13:04 PM UTCgoldsimonStatusNone=>Need Info
    Fri 21 Dec 2012 12:56:02 PM UTCriccardomanfrinCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1