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:
HIYAMA Manabu 2012-10-11 16:25:03 +09:00 committed by FUJITA Tomonori
parent 398d9a4ba3
commit c42673def1

View File

@ -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))