commit correct stuff

This commit is contained in:
Nico Schottelius 2019-03-04 18:55:25 +01:00
parent 59655e0d32
commit a274dcbcb8

View file

@ -244,28 +244,32 @@ class L2Controller(object):
cpu_header = CpuHeader(packet.payload)
log.debug("cpu = {}".format(cpu_header.__repr__()))
ether_part = pkg[Ether]
ether_part.type = cpu_header.type
sz = 0
for field in CpuHeader.fields_desc:
sz += field.sz
shift_by = sz -1
shift_by = sz
log.debug("Len of cpu= {}, shift={}".format(sz, shift_by))
ether_orig = Ether(src=packet.src, dst=packet.dst, type=0x86dd)
#orig_packet = ether_orig / IPv6(packet.load[shift_by:])
for i in range(1,10):
try:
orig_packet = ether_orig / IPv6(packet.load[i:])
except Except
ether_orig = Ether(src=packet.src, dst=packet.dst, type=cpu_header.type)
orig_packet = ether_orig / IPv6(packet.load[sz:])
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
else:
print("Broken pkg: {}".format(pkg.__repr__()))