lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #50218] ARP reply: reusing pbuf doesnt work


From: Sven G.
Subject: [lwip-devel] [bug #50218] ARP reply: reusing pbuf doesnt work
Date: Fri, 3 Feb 2017 10:37:16 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/49.0.2623.108 Chrome/49.0.2623.108 Safari/537.36

URL:
  <http://savannah.nongnu.org/bugs/?50218>

                 Summary: ARP reply: reusing pbuf doesnt work
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: hopfensga
            Submitted on: Fri 03 Feb 2017 10:37:15 AM GMT
                Category: ARP
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
            lwIP version: 2.0.0

    _______________________________________________________

Details:

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.




    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?50218>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]