[icmp6] forward NDP multicast to controller in correct fashion

This commit is contained in:
Nico Schottelius 2019-03-04 14:07:05 +01:00
parent 165f0e6b98
commit 0fa70432d1
4 changed files with 39 additions and 27 deletions

View File

@ -432,9 +432,18 @@ DEBUG:main:INCOMING: <Ether dst=33:33:ff:00:00:42 src=00:00:0a:00:00:01 type=0x
**** Requirements
*** Performance comparison
*** Feature/Functionality difference / overview
*** Feature/Functionality difference / overview / Challenges in P4
**** ICMP6: checksum over payload
- variable length, up to 65k
**** Synchronisation with the controller
- Double data type definition -> might differ
- TYPE_CPU for ethernet
- Port ingress offset (9 vs. 16 bit)
**** Not included
- DNS64 - has already been solved in a different domain
*** References / Follow up
**** RFC 2460 IPv6 (Checksum https://tools.ietf.org/html/rfc2460#section-8.1)
**** RFC 3810 MLD2 https://tools.ietf.org/html/rfc3810

View File

@ -35,10 +35,8 @@ class L2Controller(object):
# Command line mapping
self.modes = ['base', 'router']
self.info={}
self.info['ndp_multicast'] = ipaddress.ip_network("ff02::1:ff00:0/104")
self.info['ndp_multicast'] = ipaddress.ip_network(u"ff02::1:ff00:0/104")
self.address_suffix = 42
@ -146,10 +144,15 @@ class L2Controller(object):
def fill_tables(self):
self.controller.table_clear("v6_routing")
self.controller.table_clear("v6_networks")
for v6route in self.v6_routes[self.mode]:
net = self.prefix_to_net(v6route['net'], self.v6_mask)
self.controller.table_add("v6_routing", "set_egress_port", [net], [v6route['port']])
self.controller.table_add("v6_networks", "set_egress_port", [net], [v6route['port']])
for v6net in self.info['ndp_multicast']:
net = str(v6net)
self.controller.table_add("v6_networks", "controller_reply", [net])
self.controller.table_clear("v4_routing")
for v4route in self.v4_routes[self.mode]:

View File

@ -15,6 +15,7 @@ typedef bit<16> mcast_t;
const bit<16> TYPE_IPV4 = 0x0800;
const bit<16> TYPE_IPV6 = 0x86DD;
const bit<16> TYPE_CPU = 0x4242;
const bit<16> TYPE_DEBUG = 0x2323;
const bit<8> PROTO_ICMP = 1;

View File

@ -18,13 +18,16 @@ control MyIngress(inout headers hdr,
/********************** ACTIONS ***********************************/
/* As the name says */
action drop() {
mark_to_drop();
}
/* As the name says */
action send_to_controller() {
action set_egress_port (port_t out_port) {
standard_metadata.egress_spec = out_port;
}
action controller_debug() {
hdr.ethernet.ethertype = TYPE_DEBUG;
clone3(CloneType.I2E, 100, meta);
}
@ -33,8 +36,7 @@ control MyIngress(inout headers hdr,
clone3(CloneType.I2E, 100, meta);
}
/* Output PKG on correct ports (plural) */
action multicast_pkg(mcast_t mcast_grp) {
action multicast_pkg(mcast_t mcast_grp) { /* Output PKG on correct ports (plural) */
standard_metadata.mcast_grp = mcast_grp;
}
@ -54,7 +56,7 @@ control MyIngress(inout headers hdr,
hdr.icmp6.type: exact;
}
actions = {
send_to_controller;
controller_debug;
icmp6_neighbor_solicitation;
NoAction;
}
@ -70,12 +72,12 @@ control MyIngress(inout headers hdr,
}
actions = {
multicast_pkg;
send_to_controller;
controller_debug;
NoAction;
}
size = NDP_TABLE_SIZE;
default_action = NoAction;
// default_action = send_to_controller;
// default_action = controller_debug;
}
/* Handle multicast registration of NDP */
@ -85,12 +87,12 @@ control MyIngress(inout headers hdr,
}
actions = {
multicast_pkg;
send_to_controller;
controller_debug;
NoAction;
}
size = NDP_TABLE_SIZE;
default_action = NoAction;
// default_action = send_to_controller;
// default_action = controller_debug;
}
/********************** NDP support ***********************************/
@ -103,12 +105,12 @@ control MyIngress(inout headers hdr,
}
actions = {
multicast_pkg;
send_to_controller;
controller_debug;
NoAction;
}
size = NDP_TABLE_SIZE;
// default_action = NoAction;
default_action = send_to_controller;
default_action = controller_debug;
}
@ -130,28 +132,24 @@ control MyIngress(inout headers hdr,
*/
}
/********************** ROUTING (egress definiton) TABLES ***********************************/
table v6_addresses {
key = {
hdr.ipv6.dst_addr: exact;
// hdr.ipv6.next_header: exact;
}
actions = {
// icmp6_answer;
send_to_controller;
controller_debug;
controller_reply;
NoAction;
}
size = ADDRESS_TABLE_SIZE;
// default_action = send_to_controller;
default_action = NoAction;
}
/********************** ROUTING (egress definiton) TABLES ***********************************/
action set_egress_port (port_t out_port) {
standard_metadata.egress_spec = out_port;
}
table v6_routing {
table v6_networks {
key = {
hdr.ipv6.dst_addr: lpm;
}
@ -163,6 +161,7 @@ control MyIngress(inout headers hdr,
default_action = NoAction;
}
table v4_routing {
key = {
hdr.ipv4.dst_addr: lpm;