summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHIYAMA Manabu <hiyama.manabu@po.ntts.co.jp>2012-10-11 16:25:03 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2012-10-12 02:28:32 +0900
commitc42673def1c1c6b66e8179fc861d2f1e0a868668 (patch)
tree3d8fe4dd1e44160a7b938fa99bd1ba9ea7b70370
parent398d9a4ba326022ecd0b132b663fb36f6f2beab8 (diff)
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>
-rw-r--r--ryu/lib/packet/ipv4.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/ryu/lib/packet/ipv4.py b/ryu/lib/packet/ipv4.py
index d3cc4b3e..99140d4f 100644
--- a/ryu/lib/packet/ipv4.py
+++ b/ryu/lib/packet/ipv4.py
@@ -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))