From c02cf0b2e79443bd9501b5db1444a68bd64d6c23 Mon Sep 17 00:00:00 2001 From: Ryan Goodfellow Date: Thu, 1 Sep 2022 17:41:47 -0700 Subject: [PATCH] check that ipv6 header is valid before using This currently causes a crash in x4c compiled code. A good question is what should happen here. According to P4 spec x4c should emit an unspecified value. According to ry we should apport the pipeline. - https://github.com/oxidecomputer/p4/issues/6 Perhaps we can catch some of these at compile time? - https://github.com/oxidecomputer/p4/issues/7 --- test/src/p4/sidecar-lite.p4 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/src/p4/sidecar-lite.p4 b/test/src/p4/sidecar-lite.p4 index 37b1e7a4..1dc55042 100644 --- a/test/src/p4/sidecar-lite.p4 +++ b/test/src/p4/sidecar-lite.p4 @@ -420,13 +420,13 @@ control local( apply { local.apply(); - - bit<16> ll = 16w0xff02; - - //TODO this is backwards should be - //if(hdr.ipv6.dst[127:112] == ll) { - if(hdr.ipv6.dst[15:0] == ll) { - is_local = true; + if(hdr.ipv6.isValid()) { + bit<16> ll = 16w0xff02; + //TODO this is backwards should be + //if(hdr.ipv6.dst[127:112] == ll) { + if(hdr.ipv6.dst[15:0] == ll) { + is_local = true; + } } }