packet lib: fix ipv4 assertion of option field
Signed-off-by: HIYAMA Manabu <hiyama.manabu@po.ntts.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
398d9a4ba3
commit
c42673def1
@ -73,7 +73,7 @@ class ipv4(packet_base.PacketBase):
|
||||
self.ttl, self.proto, 0, self.src, self.dst)
|
||||
|
||||
if self.option:
|
||||
assert struct.calcsize('I') >= len(self.option)
|
||||
assert (self.length - ipv4._MIN_LEN) >= len(self.option)
|
||||
hdr[ipv4._MIN_LEN:ipv4._MIN_LEN + len(self.option)] = self.option
|
||||
|
||||
self.csum = socket.htons(packet_utils.checksum(hdr))
|
||||
|
Loading…
Reference in New Issue
Block a user