buglwIP - A Lightweight TCP/IP stack - Bugs: bug #34534, Error in sending fragmented IP if...

 
 

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

bug #34534: Error in sending fragmented IP if MEM_ALIGNMENT > 2

Submitter:  Andriy Korud <akorud>
Submitted:  Wed 12 Oct 2011 05:49:20 AM UTC
   
 
Category:  IPv4 Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Fixed
Privacy:  Public Assigned to:  goldsimon
Open/Closed:  Closed Planned Release:  None
lwIP version:  1.4.0

Fri 24 Feb 2012 09:45:52 AM UTC, comment #2: 

Adapted summary:

When ETH_PAD_SIZE is set to 0, this also happens for MEM_ALIGNMENT > 2.

Simon Goldschmidt <goldsimon>
Group administrator
Wed 12 Oct 2011 04:24:58 PM UTC, comment #1: 

Well spot! Although I doubt that many people use a MEM_ALIGNMENT setting > 4 (and I think I did not ever try that myself), I'm still happy if it works.

I've changed it to:

(u8_t *)payload_mem + LWIP_MEM_ALIGN_SIZE(offset)

which works because 'offset' is zero in that case. This also means that the caller of pbuf_alloced_custom() is now responsible for correct alignment of 'payload_mem' (not a big deal, I guess - it's only used for ip_frag, yet, anaway).

Fixed, thanks for reporting.

BTW: adapted summary: it worked correctly for a MEM_ALIGNMENT of 4

Simon Goldschmidt <goldsimon>
Group administrator
Wed 12 Oct 2011 05:49:20 AM UTC, original submission:  

Hi, I've discovered that this change "Fixed bug #29361 (ip_frag has problems with zero-copy DMA MACs) by adding custom pbufs and implementing custom pbufs that reference other (original) pbufs." has introduced new problem.
In line 379 in pbuf.c new custom pbuf is referenced with alignment, resulting wrong data to be sent. In ip_frag() too chained pbuf's are created for each fragment: for header and payload. Header takes 20 bytes and payload instead to be referenced to position +20, points to byte at +32 (MEM_ALIGNMENT 32). This cause bytes in range 20..31 are not sent at all.
How to reproduce: set MEM_ALIGNMENT to 32 and try to ping with packets > MTU. Ping replies will return corrupted.
Temporary solution (works for me) - rollback mentioned change. Probably removing p->pbuf.payload = LWIP_MEM_ALIGN((void )((u8_t )payload_mem + offset)); will also work, I'm not sure of side effects.

Andriy Korud <akorud>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-02-24 goldsimon SummaryError in sending fragmented IP if MEM_ALIGNMENT &gt; 4 Error in sending fragmented IP if MEM_ALIGNMENT > 2
    2011-10-12 goldsimon Open/ClosedOpen Closed
    2011-10-12 goldsimon StatusNone Fixed
        Assigned toNone goldsimon
        Planned Release 1.4.1
        SummaryError in sending fragmented IP if MEM_ALIGNMENT &gt; 1 Error in sending fragmented IP if MEM_ALIGNMENT > 4

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code