Begin icmp6 in controller -> pass special info
This commit is contained in:
parent
b3e51d550a
commit
7f1e9f6252
5 changed files with 81 additions and 22 deletions
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import nnpy
|
||||
import struct
|
||||
|
||||
|
|
@ -16,17 +18,28 @@ import argparse
|
|||
import subprocess
|
||||
|
||||
# Broken in python2
|
||||
#import ipaddress
|
||||
import ipaddress
|
||||
|
||||
logging.basicConfig()
|
||||
log = logging.getLogger("main")
|
||||
|
||||
|
||||
|
||||
class CpuHeader(Packet):
|
||||
name = 'CpuPacket'
|
||||
fields_desc = [BitField('ingress_port', 0, 16)]
|
||||
|
||||
|
||||
class L2Controller(object):
|
||||
def __init__(self, sw_name):
|
||||
# Command line mapping
|
||||
self.modes = ['base', 'router']
|
||||
|
||||
|
||||
self.info={}
|
||||
self.info['ndp_multicast'] = ipaddress.ip_network("ff02::1:ff00:0/104")
|
||||
|
||||
|
||||
self.address_suffix = 42
|
||||
|
||||
# Network / egress
|
||||
|
|
@ -145,9 +158,13 @@ class L2Controller(object):
|
|||
|
||||
self.controller.table_clear("v6_addresses")
|
||||
for v6addr in self.v6_addresses[self.mode]:
|
||||
self.controller.table_add("v6_addresses", "icmp6_answer", [v6addr['addr']])
|
||||
self.controller.table_add("v6_addresses", "send_to_controller", [v6addr['addr']])
|
||||
|
||||
|
||||
def gen_ndp_multicast_addr(self, addr):
|
||||
""" append the 24 bit of the address to the multicast address"""
|
||||
return ipaddress.ip_address(int(self.info['ndp_multicast']) + (int(addr) & 0xffffff))
|
||||
|
||||
def config_hosts(self):
|
||||
""" Assumptions:
|
||||
- all routes are networks (no /128 v6 or /32 v4
|
||||
|
|
@ -207,10 +224,15 @@ class L2Controller(object):
|
|||
|
||||
self.debug_print_pkg(pkg)
|
||||
|
||||
if packet.type == 0x800:
|
||||
if packet.type == 0x0800:
|
||||
pass
|
||||
elif packet.type == 0x86dd:
|
||||
pass
|
||||
|
||||
elif packet.type == 0x4242:
|
||||
# CPU header included
|
||||
print("Special handling needed")
|
||||
pass
|
||||
else:
|
||||
print("Broken pkg: {}".format(pkg))
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue