Get shift from cpuheader def
This commit is contained in:
parent
b465b366ea
commit
816f11c864
1 changed files with 9 additions and 1 deletions
|
@ -248,8 +248,16 @@ class L2Controller(object):
|
|||
|
||||
ether_part.type = cpu_header.type
|
||||
|
||||
bits = 0
|
||||
for field in CpuHeader.fields_desc:
|
||||
bits += field.sz
|
||||
|
||||
shift_by = (bits/8) -1
|
||||
|
||||
log.debug("Len of cpu= {}, {}, shift={}".format(bits, bits/8, shift_by)
|
||||
|
||||
ether_orig = Ether(src=packet.src, dst=packet.dst, type=0x86dd)
|
||||
orig_packet = ether_orig / IPv6(packet.load[6:])
|
||||
orig_packet = ether_orig / IPv6(packet.load[shift_by:])
|
||||
log.debug("o={}".format(orig_packet.__repr__()))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue