buglwIP - A Lightweight TCP/IP stack - Bugs: bug #50218, ARP reply: reusing pbuf doesnt work

 
 

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

bug #50218: ARP reply: reusing pbuf doesnt work

Submitted by:  Sven G. <hopfensga>
Submitted on:  Fri 03 Feb 2017 10:37:15 AM UTC  
 
Category: ARPSeverity: 3 - Normal
Item Group: Faulty BehaviourStatus: Duplicate
Privacy: PublicAssigned to: None
Open/Closed: ClosedPlanned Release: None
lwIP version: 2.0.0

Fri 03 Feb 2017 10:41:54 AM UTC, comment #1:

Already fixed in git head:

http://git.savannah.gnu.org/cgit/lwip.git/commit/?id=199c38de2922dd661ed991e577e0709ca15c4980

But thanks for reporting!!

Dirk Ziegelmeier <dziegel>
Project Member
Fri 03 Feb 2017 10:37:15 AM UTC, original submission:

I implemented a zero-copy rx, almost like the example in pbuf.c. Since the pbuf initialized with:

struct pbuf* p = pbuf_alloced_custom(PBUF_RAW, /* initialize custom pbuf */
ps_dma_desc->length,
PBUF_REF,
&(my_pbuf->p),
ps_dma_desc->data,
RX_BUFFER_SIZE);

The pbuf of an arp request is of type PBUF_REF, when the etharp_input() function tries to reuse this pbuf for a reply the pbuf is handed over to ethernet_output. Ethernet output tries to call:

if (pbuf_header(p, SIZEOF_ETH_HDR) != 0) {
goto pbuf_header_failed;
}

But pbuf_header failes on a pbuf of type PBUF_REF.

...
else if (type == PBUF_REF || type == PBUF_ROM) {
/* hide a header in the payload? */
if ((header_size_increment < 0) && (increment_magnitude <= p->len)) {
/* increase payload pointer */
p->payload = (u8_t *)p->payload - header_size_increment;
} else if ((header_size_increment > 0) && force) {
p->payload = (u8_t *)p->payload - header_size_increment;
} else {
/* cannot expand payload to front (yet!)
* bail out unsuccessfully */
return 1;
}
...
since force == 0, pbuf_header_impl() fails to adjust the payload pointer, and no arp reply is send.

Sven G. <hopfensga>

 

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 dziegel (Posted a comment)
  • -unavailable- added by hopfensga (Submitted the item)
  • -unavailable- added by hopfensga
  •  

    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
    Fri 03 Feb 2017 10:41:54 AM UTCdziegelStatusNone=>Duplicate
      Open/ClosedOpen=>Closed
    Fri 03 Feb 2017 10:37:15 AM UTChopfensgaCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1