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

Submitted by:  Andriy Korud <akorud>
Submitted on:  Wed 12 Oct 2011 05:49:20 AM UTC  
 
Category: IPv4Severity: 3 - Normal
Item Group: Faulty BehaviourStatus: Fixed
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned 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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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>

 

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 akorud (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 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 24 Feb 2012 09:45:52 AM UTCgoldsimonSummaryError in sending fragmented IP if MEM_ALIGNMENT > 4=>Error in sending fragmented IP if MEM_ALIGNMENT > 2
    Wed 12 Oct 2011 04:25:05 PM UTCgoldsimonOpen/ClosedOpen=>Closed
    Wed 12 Oct 2011 04:24:58 PM UTCgoldsimonStatusNone=>Fixed
      Assigned toNone=>goldsimon
      Planned Release=>1.4.1
      SummaryError in sending fragmented IP if MEM_ALIGNMENT > 1=>Error in sending fragmented IP if MEM_ALIGNMENT > 4

    Back to the top


    Powered by Savane 3.1-cleanup1