From 542b4ddd5074de83ba5487a590c152611e123a9f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 4 Mar 2019 16:38:06 +0100 Subject: [PATCH] rename to v4networks --- p4app/controller.py | 4 +++- p4src/parsers.p4 | 6 +++--- p4src/static-mapping.p4 | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/p4app/controller.py b/p4app/controller.py index 6ee06fe..e1b5f24 100644 --- a/p4app/controller.py +++ b/p4app/controller.py @@ -233,7 +233,9 @@ class L2Controller(object): elif packet.type == 0x86dd: pass elif packet.type == 0x4242: - print("Special handling needed") + cpu_header = CpuHeader(packet.payload) + original_pkg = pkg[0:111] + pass elif packet.type == 0x2323: # Set back (incorrectly maybe) to IPv6 diff --git a/p4src/parsers.p4 b/p4src/parsers.p4 index 1c7cfd4..4988ede 100644 --- a/p4src/parsers.p4 +++ b/p4src/parsers.p4 @@ -75,12 +75,12 @@ parser MyParser(packet_in packet, control MyDeparser(packet_out packet, in headers hdr) { apply { - /* only if information is sent to the controller */ - packet.emit(hdr.cpu); - /* always */ packet.emit(hdr.ethernet); + /* only if information is sent to the controller */ + packet.emit(hdr.cpu); + /* either */ packet.emit(hdr.ipv4); packet.emit(hdr.ipv6); diff --git a/p4src/static-mapping.p4 b/p4src/static-mapping.p4 index 5836616..35d9d46 100644 --- a/p4src/static-mapping.p4 +++ b/p4src/static-mapping.p4 @@ -164,7 +164,7 @@ control MyIngress(inout headers hdr, } - table v4_routing { + table v4_networks { key = { hdr.ipv4.dst_addr: lpm; } @@ -203,6 +203,7 @@ control MyEgress(inout headers hdr, apply { // ingress clone if (standard_metadata.instance_type == 1){ + hdr.ethernet.ethertype = TYPE_CPU; hdr.cpu.setValid(); hdr.cpu.task = meta.task; }