commit correct stuff
This commit is contained in:
parent
59655e0d32
commit
a274dcbcb8
1 changed files with 15 additions and 11 deletions
|
@ -244,28 +244,32 @@ class L2Controller(object):
|
||||||
cpu_header = CpuHeader(packet.payload)
|
cpu_header = CpuHeader(packet.payload)
|
||||||
|
|
||||||
log.debug("cpu = {}".format(cpu_header.__repr__()))
|
log.debug("cpu = {}".format(cpu_header.__repr__()))
|
||||||
ether_part = pkg[Ether]
|
|
||||||
|
|
||||||
ether_part.type = cpu_header.type
|
|
||||||
|
|
||||||
sz = 0
|
sz = 0
|
||||||
for field in CpuHeader.fields_desc:
|
for field in CpuHeader.fields_desc:
|
||||||
sz += field.sz
|
sz += field.sz
|
||||||
|
|
||||||
shift_by = sz -1
|
shift_by = sz
|
||||||
|
|
||||||
log.debug("Len of cpu= {}, shift={}".format(sz, shift_by))
|
log.debug("Len of cpu= {}, shift={}".format(sz, shift_by))
|
||||||
|
|
||||||
ether_orig = Ether(src=packet.src, dst=packet.dst, type=0x86dd)
|
ether_orig = Ether(src=packet.src, dst=packet.dst, type=cpu_header.type)
|
||||||
#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
|
|
||||||
|
|
||||||
|
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)
|
||||||
|
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:
|
else:
|
||||||
print("Broken pkg: {}".format(pkg.__repr__()))
|
print("Broken pkg: {}".format(pkg.__repr__()))
|
||||||
|
|
Loading…
Reference in a new issue