I would like to know if it's possible to completely remove a packet payload from a packet inside a .p4 program or at least modify it to random data. The reason behind this is that I'm cloning a packet and sending it to a different host (monitor) and this host does not need the packets payload.
Asked
Active
Viewed 441 times
1 Answers
1
Depends on what are you trying to do. If you would like to remove the some kind of header then it's enough to call
hdr.random_header.setInvalid()
if you call that in Egress it should remove fields of the header from the packet. If you have len fields in headers you might also use
truncate(new_size)
when you know the size of packet without payload. If you already know easier option please share it here.

MonteChrist0
- 151
- 4
-
Hi, the option using truncate and updating each headers length field worked for me! Couldn't find any other. Thanks!! – Henrique Becker Brum Dec 22 '21 at 12:55