[P4-dev] P4 support for PCAP

James Bensley jwbensley at gmail.com
Sun Jul 16 09:42:23 EDT 2017

On 14 July 2017 at 23:17, Antonin Bas <antonin at barefootnetworks.com> wrote:
> Hi James,
> At this point, I am not sure how you would be able to achieve this. Packet
> errors like the ones you mention should result in a bmv2 error log message
> (although some errors may not be supported at this stage). We can imagine in
> the future supporting a command-line option that will log those incorrect
> packets to a special pcap file, but so far you are the only one that has
> expressed interest in such a feature. Fee free to open an issue in the bmv2
> repo requesting this feature and tag it as "improvement".
> Thanks,
> Antonin

Hi Antonin,

Many thanks for your response. Initially I am thinking about the
scenario of writing p4 code and building it on x86 for testing
purposes, and having the ability to capture packets to a PCAP file but
only those of "interest" (packets with errors, packets with specific
properties like TTL == 0, no route in the forwarding table etc).

Further down the line, in the case of building to a hardware target
like a router or switch, some NPUs set the next-hop/egress interface
to a special drop index like 0xFF when there is a problem with the
packet or there is a lookup failure (no route to destination). I'd
like to be able to set the next hop interface index it to a physical
interface of my chosing (or logical interface like over a GRE tunnel
for example) to capture those packets with errors or issues to debug
the P4 program on the target device.

I'm not sure how practicle this is. If you think it's a good idea I
can open a feature requests on GitHub.


More information about the P4-dev mailing list