[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-devel] pbuf_cat() does not update total_len
From: |
Laurenz Kamp |
Subject: |
Re: [lwip-devel] pbuf_cat() does not update total_len |
Date: |
Tue, 03 Feb 2015 20:36:12 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
Ok, thank you both for your help and the explanation.
What confused me was that pbuf_cat() updates all tot_len fields in the first
chain, but
not in the second. Wouldn't it be sufficient to only update the tot_len field
in the first
pbuf of the first chain?
Best regards,
Laurenz
------ Original Message ------
Date: Tue, 03 Feb 2015 20:28:57 +0100
Subject: Re: [lwip-devel] pbuf_cat() does not update total_len
From: address@hidden
To: address@hidden
> Laurenz Kamp wrote:
>> First pbuf: a.len = 10;
>> a.total_len = 25;
>> a.next = b;
>> Second pbuf: b.len = 15;
>> b.total_len = 15; <-- Should be 25.
>> b.next = NULL;
>
> Laurenz, your assumption is wrong. The above numbers are exactly right as
> they are.
>
>> As far as I understand, all pbufs in a chain have the same total_len value,
>> but pbuf_cat doesn't
>> update b.total_len. Is this behavior intentioned or a bug?
>
> As written above, it's expected behaviour. And the reason for this is that
> you can create or hide network headers in the pbuf (as it gets passed up or
> down the stack) and don't need to manipulate the whole chain but only the
> first pbuf in it.
>
> Simon
>
> _______________________________________________
> lwip-devel mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/lwip-devel
>