Begin switching in controler based on task

This commit is contained in:
Nico Schottelius 2019-03-04 18:58:22 +01:00
parent a274dcbcb8
commit cb67188780

View file

@ -240,35 +240,19 @@ class L2Controller(object):
elif packet.type == 0x86dd:
pass
elif packet.type == 0x4242:
log.debug("CPU packet")
cpu_header = CpuHeader(packet.payload)
log.debug("cpu = {}".format(cpu_header.__repr__()))
sz = 0
for field in CpuHeader.fields_desc:
sz += field.sz
shift_by = sz
log.debug("Len of cpu= {}, shift={}".format(sz, shift_by))
ether_orig = Ether(src=packet.src, dst=packet.dst, type=cpu_header.type)
orig_packet = ether_orig / IPv6(packet.load[sz:])
orig_packet = ether_orig / IPv6(cpu_header.load)
log.debug("o={}".format(orig_packet.__repr__()))
orig_packet = ether_orig / IPv6(cpu_header.load)
log.debug("o2={}".format(orig_packet.__repr__()))
# for i in range(1,15):
# try:
# orig_packet = ether_orig / IPv6(packet.load[i:])
# log.debug("o={} {}".format(orig_packet.__repr__(), i))
# except Exception:
# pass
if cpu_header.task == self.task['DEBUG']:
pass
elif cpu_header.task == self.task['ICMP6_NS']:
log.debug("Doing neighbor solicitation")
elif cpu_header.task == self.task['ICMP6_GENERAL']:
log.debug("Replying to ICMP packet")
else: