Closed 4tXJ7f closed 7 years ago
Hi Andres, We were not able to reproduce this issue, the JSON file we generate with the latest compiler version uses "*" as expected. Are you using an old version of p4c? I think the handling of variable-length fields was fixed recently (within the last month or so).
Hmm, it looks like it works with the newest version. I thought that I had updated to the newest version before reporting the issue, sorry about that and thanks a lot for the reply.
P4 programs with variable length fields violate an assertion when compiled with
p4c
and run onsimple_switch
:This might be due to a bug in
p4c
: for variable length fields, it generates JSON with concrete lengths, e.g.:But the documentation of the BMv2 JSON input format states that:
The assertion failure can be a reproduced as follows:
header ipv4_t ipv4;
parser start { extract(ipv4); return ingress; }
control ingress { }
control egress { }
$ p4c-bm2-ss --p4v 14 -o vl_field_test.json vl_field_test.p4
$ sudo simple_switch --log-console -i 0@veth2 -i 1@veth4 vl_field_test.json
$ tcpdump -XX -r test.pcap reading from file test.pcap, link-type EN10MB (Ethernet) 14:58:46.579815 00:00:00:00:00:00 (oui Ethernet) > 04:00:00:00:00:00 (oui Unknown) Null Information, send seq 0, rcv seq 0, Flags [Command], length 490 0x0000: 0400 0000 0000 0000 0000 0000 0000 0000 ................ 0x0010: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0020: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0030: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0040: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0050: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0060: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0070: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0080: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0090: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00a0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00e0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0100: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0110: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0120: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0130: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0140: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0150: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0160: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0170: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0180: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0190: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x01a0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x01b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x01c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x01d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x01e0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x01f0: 0000 0000 0000 0000 ........ $ sudo scapy
Sending the packet will make
simple_switch
crash with the assertion failure mentioned in the beginning.I'd be happy to help fixing the issue but I am not quite sure who's at fault here (I am suspecting
p4c
because of the JSON documentation) and whether this is expected or not.Thanks!