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

ec richard.mayers92 at gmail.com
Sat Oct 13 08:50:06 EDT 2018


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,

> 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