From 6f83eeddb293fb26f60d9fe2417bf514e17e8ad8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 4 Mar 2019 14:27:12 +0100 Subject: [PATCH] Keep packet type correct for multicast / ndp --- p4app/controller.py | 6 ++++-- p4src/static-mapping.p4 | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/p4app/controller.py b/p4app/controller.py index 20a9bff..da961fa 100644 --- a/p4app/controller.py +++ b/p4app/controller.py @@ -150,7 +150,7 @@ class L2Controller(object): self.controller.table_add("v6_networks", "set_egress_port", [net], [v6route['port']]) net = str(self.info['ndp_multicast']) - self.controller.table_add("v6_networks", "controller_debug", [net]) + self.controller.table_add("v6_networks", "controller_reply", [net]) self.controller.table_clear("v4_routing") @@ -230,10 +230,12 @@ class L2Controller(object): pass elif packet.type == 0x86dd: pass - elif packet.type == 0x4242: print("Special handling needed") pass + elif packet.type == 0x2323: + print("Debug pkg") + pass else: print("Broken pkg: {}".format(pkg.__repr__())) return diff --git a/p4src/static-mapping.p4 b/p4src/static-mapping.p4 index 920af6e..a61eaf3 100644 --- a/p4src/static-mapping.p4 +++ b/p4src/static-mapping.p4 @@ -201,21 +201,10 @@ control MyEgress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) { apply { - /* set tcp header valid after modifying it -- keep this in mind*/ - // hdr.tcp.setValid(); - - // If ingress clone + // ingress clone if (standard_metadata.instance_type == 1 && meta.ether_modified == 1){ hdr.ethernet.ethertype = meta.ethertype; - - // hdr.cpu.setValid(); - // hdr.cpu.srcAddr = hdr.ethernet.srcAddr; - // hdr.cpu.ingress_port = (bit<16>)meta.ingress_port; - - // truncate((bit<32>)22); //ether+cpu header } - - } } @@ -231,3 +220,14 @@ MyEgress(), MyComputeChecksum(), MyDeparser() ) main; + + + /* set tcp header valid after modifying it -- keep this in mind*/ + // hdr.tcp.setValid(); + + + // hdr.cpu.setValid(); + // hdr.cpu.srcAddr = hdr.ethernet.srcAddr; + // hdr.cpu.ingress_port = (bit<16>)meta.ingress_port; + + // truncate((bit<32>)22); //ether+cpu header