try 42: ndp in the switch. this episode is with checksums...
This commit is contained in:
parent
492888fd2f
commit
c89441001b
3 changed files with 53 additions and 35 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue