From e48abdb254fc682bf4d9c74138d50b46948a2210 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 25 Mar 2019 14:28:36 +0100 Subject: [PATCH] Use symbolic names in debugging --- p4app/controller.py | 17 +++-------------- p4src/static-mapping.p4 | 24 +++++------------------- 2 files changed, 8 insertions(+), 33 deletions(-) diff --git a/p4app/controller.py b/p4app/controller.py index c40669d..5f1d42a 100755 --- a/p4app/controller.py +++ b/p4app/controller.py @@ -435,18 +435,7 @@ class L2Controller(object): ether_orig = "" orig_packet = "" - if packet.type == 0x0800: - log.debug("Received raw (untagged) IPv4 packet - BUG") - self.debug_print_pkg(pkg) - - elif packet.type == 0x86dd: - log.debug("Received raw (untagged) IPv6 packet - BUG") - self.debug_print_pkg(pkg) - - log.debug("cpu = {}".format(cpu_header.__repr__())) - log.debug("v4 reassambled={}".format(orig_packet.__repr__())) - - elif packet.type == 0x4242: + if packet.type == 0x4242: cpu_header = CpuHeader(packet.payload) # Not necessary anymore - cpu decoding works @@ -462,7 +451,7 @@ class L2Controller(object): print("Broken pkg: {}".format(pkg.__repr__())) return else: - print("Broken pkg: {}".format(pkg.__repr__())) + print("Broken / unhandled pkg: {}".format(pkg.__repr__())) return # Process parsed @@ -481,7 +470,7 @@ class L2Controller(object): if ICMPv6EchoRequest in orig_packet: self.handle_icmp6_echo_request(orig_packet) else: - log.debug("unhandled reassambled={} from table {}".format(orig_packet.__repr__(), cpu_header.table_id)) + log.debug("unhandled reassambled={} from table {}".format(orig_packet.__repr__(), table_id_fieds[cpu_header.table_id])) def run_cpu_port_loop(self): diff --git a/p4src/static-mapping.p4 b/p4src/static-mapping.p4 index 79acc21..971c30f 100644 --- a/p4src/static-mapping.p4 +++ b/p4src/static-mapping.p4 @@ -77,7 +77,7 @@ control MyIngress(inout headers hdr, /* NAT46: protocol unspecific changes */ action nat46_generic(ipv6_addr_t src, ipv6_addr_t dst) { - hdr.ethernet.ethertype=TYPE_IPV6; + hdr.ethernet.ethertype = TYPE_IPV6; hdr.ipv6.dst_addr = dst; hdr.ipv6.src_addr = src; @@ -334,27 +334,13 @@ control MyIngress(inout headers hdr, /********************** APPLYING TABLES ***********************************/ apply { if(hdr.ipv6.isValid()) { - icmp6.apply(); /* icmp6 echo, icmp6 ndp */ - nat64.apply(); /* translating */ - v6_networks.apply(); - - // if(!nat64.apply().hit) { /* v6 -> v4 */ - // controller_debug_table_id(TABLE_NAT64); - // } - // if(!v6_networks.apply().hit) { - // controller_debug_table_id(TABLE_V6_NETWORKS); - // } + icmp6.apply(); /* icmp6 echo, icmp6 ndp */ + nat64.apply(); /* translating */ + v6_networks.apply(); /* egress / routing */ } if(hdr.ipv4.isValid()) { - nat46.apply(); /* v4->v6 */ + nat46.apply(); /* v4->v6 */ v4_networks.apply(); /* routing, egress */ - - // if(!nat46.apply().hit) { /* v4->v6 */ - // controller_debug_table_id(TABLE_NAT46); - // } - // if(!v4_networks.apply().hit) { /* routing, egress */ - // controller_debug_table_id(TABLE_V4_NETWORKS); - // } } } }