[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 **** Requirements
*** Performance comparison *** 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 **** Not included
- DNS64 - has already been solved in a different domain - DNS64 - has already been solved in a different domain
*** References / Follow up *** References / Follow up
**** RFC 2460 IPv6 (Checksum https://tools.ietf.org/html/rfc2460#section-8.1) **** RFC 2460 IPv6 (Checksum https://tools.ietf.org/html/rfc2460#section-8.1)
**** RFC 3810 MLD2 https://tools.ietf.org/html/rfc3810 **** RFC 3810 MLD2 https://tools.ietf.org/html/rfc3810

View file

@ -35,10 +35,8 @@ class L2Controller(object):
# Command line mapping # Command line mapping
self.modes = ['base', 'router'] self.modes = ['base', 'router']
self.info={} 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 self.address_suffix = 42
@ -146,10 +144,15 @@ class L2Controller(object):
def fill_tables(self): def fill_tables(self):
self.controller.table_clear("v6_routing") self.controller.table_clear("v6_networks")
for v6route in self.v6_routes[self.mode]: for v6route in self.v6_routes[self.mode]:
net = self.prefix_to_net(v6route['net'], self.v6_mask) 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") self.controller.table_clear("v4_routing")
for v4route in self.v4_routes[self.mode]: 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_IPV4 = 0x0800;
const bit<16> TYPE_IPV6 = 0x86DD; const bit<16> TYPE_IPV6 = 0x86DD;
const bit<16> TYPE_CPU = 0x4242; const bit<16> TYPE_CPU = 0x4242;
const bit<16> TYPE_DEBUG = 0x2323;
const bit<8> PROTO_ICMP = 1; const bit<8> PROTO_ICMP = 1;

View file

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