Begin switching in controler based on task
This commit is contained in:
parent
a274dcbcb8
commit
cb67188780
1 changed files with 7 additions and 23 deletions
|
@ -240,35 +240,19 @@ class L2Controller(object):
|
||||||
elif packet.type == 0x86dd:
|
elif packet.type == 0x86dd:
|
||||||
pass
|
pass
|
||||||
elif packet.type == 0x4242:
|
elif packet.type == 0x4242:
|
||||||
log.debug("CPU packet")
|
|
||||||
cpu_header = CpuHeader(packet.payload)
|
cpu_header = CpuHeader(packet.payload)
|
||||||
|
|
||||||
log.debug("cpu = {}".format(cpu_header.__repr__()))
|
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)
|
ether_orig = Ether(src=packet.src, dst=packet.dst, type=cpu_header.type)
|
||||||
|
orig_packet = ether_orig / IPv6(cpu_header.load)
|
||||||
orig_packet = ether_orig / IPv6(packet.load[sz:])
|
|
||||||
log.debug("o={}".format(orig_packet.__repr__()))
|
log.debug("o={}".format(orig_packet.__repr__()))
|
||||||
|
|
||||||
orig_packet = ether_orig / IPv6(cpu_header.load)
|
if cpu_header.task == self.task['DEBUG']:
|
||||||
log.debug("o2={}".format(orig_packet.__repr__()))
|
pass
|
||||||
|
elif cpu_header.task == self.task['ICMP6_NS']:
|
||||||
|
log.debug("Doing neighbor solicitation")
|
||||||
# for i in range(1,15):
|
elif cpu_header.task == self.task['ICMP6_GENERAL']:
|
||||||
# try:
|
log.debug("Replying to ICMP packet")
|
||||||
# orig_packet = ether_orig / IPv6(packet.load[i:])
|
|
||||||
# log.debug("o={} {}".format(orig_packet.__repr__(), i))
|
|
||||||
# except Exception:
|
|
||||||
# pass
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue