[P4-dev] Craft special packet, different from the one received

cs.lev cs.lev at gmx.com
Sat Oct 13 09:50:09 EDT 2018


Wow, it indeed works! ;)

Thank you so much!

Kind wishes,
cslev

On Sat, 2018-10-13 at 14:50 +0200, ec wrote:
> Hi,
> 
> You have to set headers A and B to invalid. hdr.A.setInvalid(),
> hdr.B.setInvalid().
> 
> Then set  C and D valid. And fill its fields.
> 
> If you do that, A and B will not be deparsed. C and D will be added
> at the beginning of your packet
> 
> Kind regards,
> Edgar
> 
> > On 13 Oct 2018, at 12:16, cs.lev <cs.lev at gmx.com> wrote:
> > 
> > Hi,
> > 
> > I was wondering whether it is possible to craft a packet (not
> > necessarily from scratch) upon receiving another one?
> > 
> > In other words, assume I define in my P4 application the following
> > header types:
> > headerA
> > headerB
> > headerC
> > headerD
> > 
> > I receive a packet with headerA and headerB (but no other headers),
> > and
> > in response I would like to send back a packet with only headerC
> > and
> > headerD. Is it feasible?
> > 
> > I am playing with it, but is seems that since I do not parse
> > (correctly) headerC and headerD upon receiving the packet with only
> > headerA and headerB, any setting/manipulation (e.g., crafting) to
> > headerC and headerD does not/cannot work.
> > However, compiler does not drop any error, but packet with such
> > headers
> > are not emitted in the deparser phase.
> > 
> > Thanks,
> > cslev
> > 
> > _______________________________________________
> > P4-dev mailing list
> > P4-dev at lists.p4.org
> > http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
> 
> 



More information about the P4-dev mailing list