lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Bug in SLIPIF.C ?


From: Jani Monoses
Subject: Re: [lwip-users] Bug in SLIPIF.C ?
Date: Fri, 10 Sep 2004 11:34:06 +0300

Good, detailed description.
I wonder if it's not some recent pbuf fix that causes this regression in
slipif. I think it used to work fine even with packets larger than
PBUF_POOL_BUFSIZE.

> - If the slip driver the following code will be executed if a new buffer 
> will be allocated:
>       p = pbuf_alloc(PBUF_LINK, PBUF_POOL_BUFSIZE, PBUF_POOL);
> 
>    PBUF_POOL_BUFSIZE is set to 0x80
>  
> - In pbuf_alloc() the offset in the PBUF_LINK case will be calculated 
> (BPUF_LINK_HLEN is set to 0x10)
>       offset += PBUF_LINK_HLEN;

Hmm, slipif should not need a link layer header at all, but I guess this is
hardcoded in pbuf.c.

> - In the case PBUF_POOL the first buffer will be allocated
>       /* allocate head of pbuf chain into p */
>       p = pbuf_pool_alloc();
> 
> - After that p->tot_len will be set and p->len will be calculated
>       p->len = length > PBUF_POOL_BUFSIZE - offset? PBUF_POOL_BUFSIZE - 
> offset: length;
> 
>    Calculated p->len in this case will be 0x70
> 
> - After that the rem_length (I guess means remaining length) will be 
> calulated
>       rem_len = length - p->len;
> 
>    This calculation wil be result in a value of rem_len of 0x10
> 
> - The following loop "while (rem_len > 0) {" will allocate buffer until 
> rem_len is 0 or a negative value

> I hope this description is (more or less) usefull for you.

thanks
I'll have a closer look at the code
Jani




reply via email to

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