lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] ICMP and PBUF_REF buffer type


From: simeon.trifonov
Subject: [lwip-users] ICMP and PBUF_REF buffer type
Date: Tue, 3 Oct 2017 16:29:27 +0300

Hi,

 

I use LWIP V2.0.2. I have a problem with ICMP when I use PBUF_REF buffer for the input() function. I want to use PBUF_REF, because I have the received data already in the memory and I don’t want to copy it again, just to set the payload pointer to the already filled up buffer. DHCP protocols works without problems like this, but when I try to ping the device, I see ARP and correct answer, but then there is no response to the ICMP. After some debugging I see that the problem comes, because of the following lines (in the file icmp.c):

 

    if (pbuf_header(p, (s16_t)hlen)) {

      LWIP_DEBUGF(ICMP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("Can't move over header in packet"));

    } else {

      err_t ret;

      struct ip_hdr *iphdr = (struct ip_hdr*)p->payload;

      …

    }

 

Here the if-condition is true, instead to be 0 and the code that follows in the else-section (that prepares and send the response) is not executed.

I guess that I have to use PBUF_POOL buffer instead of PBUF_REF (this is suggested in the documentation), but when I do it, DHCP stops working. So I’m a little bit confused with the understanding of this behavior. I know that this is not a problem with the stack, just how I use it, but please, give me a short hint what I’m doing wrong…

 

Simeon

 


reply via email to

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