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

Submitter:  Sven G. <hopfensga>
Submitted:  Fri 03 Feb 2017 10:37:15 AM UTC
   
 
Category:  ARP Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Duplicate
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Planned Release:  None
lwIP version:  2.0.0

Fri 03 Feb 2017 10:41:54 AM UTC, comment #1: 
Dirk Ziegelmeier <dziegel>
Group administrator
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>

 

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

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

    Date Changed by Updated Field Previous Value => Replaced by
    2017-02-03 dziegel StatusNone Duplicate
        Open/ClosedOpen Closed
    2017-02-03 hopfensga Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code