Use symbolic names in debugging

This commit is contained in:
Nico Schottelius 2019-03-25 14:28:36 +01:00
parent 764245a914
commit e48abdb254
2 changed files with 8 additions and 33 deletions

View file

@ -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):

View file

@ -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);
// }
}
}
}