1

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.

1 Answers1

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