Prashant,

> Thanks for the feedback.
> Out of curiosity, what is the motivation of this contract about
> minimal length of chained buffer data -- surely, my case being in
> point, the chaining framework should not make any assumptions about
> how the user would use it.

There are lots of features parsing packet headers.
This guarantee allows those functions to not have to deal with buffer chains as 
part of header parsing.
Think ACLs or NAT where the IP header is in first chain and TCP header is in 
next.

Look at https://git.fd.io/vpp/tree/src/vnet/ip/ip6_hop_by_hop.c#n536
for example and think of how you can identfy all the places in the code that 
makes some sort of assumption about headers available in first chain.
(that parsing function looks like it has other length handling issues too, but 
that's slightly beside the point).

if there was a need to generate an ICMP error later in the processing path for 
your packet then you'd only get the headers in the first chain, as you see 
here: https://git.fd.io/vpp/tree/src/vnet/ip/icmp4.c#n251

a safer choice is either to prepend your new encap in front on the first buffer 
or copy more into a new buffer.

Best regards,
Ole


> 
> Regards
> -Prashant
> 
> On Tue, Sep 7, 2021 at 12:59 AM Damjan Marion <dmar...@me.com> wrote:
>> 
>> 
>> —
>> Damjan
>> 
>> 
>> 
>> On 06.09.2021., at 15:27, Prashant Upadhyaya <praupadhy...@gmail.com> wrote:
>> 
>> Hi,
>> 
>> I am using VPP21.06
>> In vlib_buffer_advance there is the following assert --
>> ASSERT ((b->flags & VLIB_BUFFER_NEXT_PRESENT) == 0 ||
>>         b->current_length >= VLIB_BUFFER_MIN_CHAIN_SEG_SIZE);
>> 
>> The above is problematic as I have a usecase where I construct a chained 
>> packet.
>> The first packet in the chain is containing just an ip4/udp/gtp header
>> and the second packet in the chain is an IP4 packet of arbitrary
>> length -- you can see that I am trying to wrap the packet into gtp via
>> chaining.
>> As a result this assert hits and brings the house down.
>> My usecase works fine when I use the non-debug build of VPP.
>> 
>> Perhaps this assert should be removed ?
>> 
>> 
>> This assert  enforces contract with the rest of the VPP code about minimal 
>> length of chaine buffer data.
>> You can remove it, but be aware of consequences. At some point things may 
>> just blow up….
>> 
>> —
>> Damjan
> 
> 

Attachment: signature.asc
Description: Message signed with OpenPGP

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#20095): https://lists.fd.io/g/vpp-dev/message/20095
Mute This Topic: https://lists.fd.io/mt/85411974/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to