diff --git a/doc/plan.org b/doc/plan.org index 0af5f6d..992d585 100644 --- a/doc/plan.org +++ b/doc/plan.org @@ -754,24 +754,43 @@ DEBUG:main:cpu = >>> ***** TODO Debug why neighbor discover does not work anymore -p4@ubuntu:~$ mx h1 tcpdump -lni any -sudo: unable to resolve host ubuntu -tcpdump: verbose output suppressed, use -v or -vv for full protocol decode -listening on any, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes +****** log + p4@ubuntu:~$ mx h1 tcpdump -lni any + sudo: unable to resolve host ubuntu + tcpdump: verbose output suppressed, use -v or -vv for full protocol decode + listening on any, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes -19:57:53.258805 IP6 fe80::200:aff:fe00:1 > ff02::1:ff00:42: ICMP6, neighbor solicitation, who has 2001:db8::42, length 32 -19:57:54.256924 IP6 2001:db8::1 > 2001:db8::1: ICMP6, destination unreachable, unreachable address 64:ff9b::a00:1, length 112 + 19:57:53.258805 IP6 fe80::200:aff:fe00:1 > ff02::1:ff00:42: ICMP6, neighbor solicitation, who has 2001:db8::42, length 32 + 19:57:54.256924 IP6 2001:db8::1 > 2001:db8::1: ICMP6, destination unreachable, unreachable address 64:ff9b::a00:1, length 112 -EBUG:main:INCOMING: > -DEBUG:main:cpu = > -DEBUG:main:reassambled=>>> -INFO:main:Doing neighbor solicitation -DEBUG:main:OUTGOING: >>> -DEBUG:main:INCOMING: >>> -****** Do we have a routing for fe80::/10? Probably not. Shouldn't we see it in the controller then? -****** TODO Implement address learning? -****** TODO Not sure whether we should react on router solicitation - - Using static routes -> should do the job + EBUG:main:INCOMING: > + DEBUG:main:cpu = > + DEBUG:main:reassambled=>>> + INFO:main:Doing neighbor solicitation + DEBUG:main:OUTGOING: >>> + DEBUG:main:INCOMING: >>> + + + After removing noise: + + DEBUG:main:reassambled=>>> + DEBUG:main:reassambled=>>> + DEBUG:main:reassambled=>>> + DEBUG:main:reassambled=>>> + DEBUG:main:reassambled=>>> + +****** Do we have routing for fe80::/10? Probably not. Shouldn't we see it in the controller then? +****** NDP is controller only! +***** TODO Maybe merge v6_address and v6_networks - /128 is the same +***** TODO Implement address learning? +***** TODO Not sure whether we should react on router solicitation + - Using static routes -> should do the job ***** TODO Implement the calculation ***** TODO Sketch the flow for session handling for icmp6 w/o packet loss - switch receives icmp6 packet for known prefix diff --git a/p4app/controller.py b/p4app/controller.py index 94a9966..00b9f7e 100644 --- a/p4app/controller.py +++ b/p4app/controller.py @@ -47,6 +47,8 @@ class L2Controller(object): self.task = dict(reversed(item) for item in cpu_fields.items()) self.info={} + + # https://en.wikipedia.org/wiki/Solicited-node_multicast_address self.info['ndp_multicast'] = ipaddress.ip_network("ff02::1:ff00:0/104") self.info['mac_address'] = "00:00:0a:00:00:42" self.info['ipv6_link_local'] = ipaddress.ip_address("fe80::200:aff:fe00:42") @@ -136,7 +138,6 @@ class L2Controller(object): return addr - def init_other_port_multicast_groups(self): """ map multicast group x to send to all ports but x - basically broadcasting without sending back to ourselves @@ -153,21 +154,6 @@ class L2Controller(object): self.controller.mc_node_associate(g_handle, n_handle) - - def init_ndp(self): - """ initialise neighbor discovery protocol""" - - # https://en.wikipedia.org/wiki/Solicited-node_multicast_address - ndp_prefix = "ff02::1:ff00:0/104" - - self.controller.table_clear("ndp") - for port in self.ports: - self.controller.table_add("ndp", "multicast_pkg", [ndp_prefix, str(port)], [str(port)]) - - - # Special rule for switch entries - self.controller.table_add("ndp_answer", "icmp6_neighbor_solicitation", ["ff02::1:ff00:42", "135"], ["2001:db8:61::42"]) - def init_boilerplate(self, sw_name): self.topo = Topology(db="topology.db") self.sw_name = sw_name @@ -180,8 +166,6 @@ class L2Controller(object): if self.cpu_port: self.controller.mirroring_add(100, self.cpu_port) -# self.init_ndp() - def config(self): self.fill_tables() self.config_hosts() @@ -192,6 +176,14 @@ class L2Controller(object): net = self.info['ndp_multicast'] self.controller.table_add("v6_networks", "controller_debug", [str(net)]) + def init_ndp_in_switch(self, addr): + icmp6_addr = self.gen_ndp_multicast_addr(addr) + icmp6_net = "{}/128".format(icmp6_addr) + + self.controller.table_add("v6_networks", + "icmp6_neighbor_solicitation", + [str(icmp6_net)], [str(addr)]) + def fill_tables(self): self.controller.table_clear("v6_networks") for v6route in self.v6_routes[self.mode]: @@ -200,6 +192,9 @@ class L2Controller(object): if self.args.multicast_to_controller: self.listen_to_icmp6_multicast() + for v6addr in self.v6_addresses[self.mode]: + self.init_ndp_in_switch(v6addr) + self.controller.table_clear("v4_networks") for v4route in self.v4_routes[self.mode]: self.controller.table_add("v4_networks", "set_egress_port", [str(v4route['net'])], [str(v4route['port'])]) @@ -401,7 +396,7 @@ class L2Controller(object): log.debug("Neighbor solicitation for checking her own IP address") elif ICMPv6MLReport2 in orig_packet and orig_packet['IPv6'].dst == 'ff02::16': mc_group = orig_packet['ICMPv6MLDMultAddrRec'].dst - log.debug("Multicast registration for {} from {} -- should probably handle this".format(mc_group, cpu_header.ingress_port)) + log.debug("Multicast registration for {} port {} -- should probably handle this".format(mc_group, cpu_header.ingress_port)) elif ICMPv6ND_RS in orig_packet and orig_packet['IPv6'].dst == 'ff02::2': src = orig_packet['IPv6'].src log.debug("Router solicitation from {} -- should probably handle this?".format(src)) diff --git a/p4src/static-mapping.p4 b/p4src/static-mapping.p4 index 3ba29c5..0497f51 100644 --- a/p4src/static-mapping.p4 +++ b/p4src/static-mapping.p4 @@ -49,6 +49,10 @@ control MyIngress(inout headers hdr, hdr.ipv6.dst_addr = hdr.ipv6.src_addr; hdr.ipv6.src_addr = addr; hdr.icmp6.type = ICMP6_NA; + + /* checksum trigger / content */ + meta.do_cksum = 1; + meta.cast_length = (bit<32>) hdr.ipv6.payload_length; } action icmp6_echo_reply() {