From 05521398c12bbca60cd87db56238500bbc08bb1c Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Thu, 30 Aug 2012 16:44:03 +0900 Subject: [PATCH] packet lib: fix ipv4 option field handling - fix the parser to set option data. - add option argument to __init__. Signed-off-by: FUJITA Tomonori --- ryu/lib/packet/ipv4.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ryu/lib/packet/ipv4.py b/ryu/lib/packet/ipv4.py index 93c38285..343049a5 100644 --- a/ryu/lib/packet/ipv4.py +++ b/ryu/lib/packet/ipv4.py @@ -27,7 +27,7 @@ class ipv4(packet_base.PacketBase): def __init__(self, version, header_length, tos, total_length, identification, flags, offset, ttl, proto, csum, - src, dst): + src, dst, option=None): super(ipv4, self).__init__() self.version = version self.header_length = header_length @@ -42,6 +42,7 @@ class ipv4(packet_base.PacketBase): self.src = src self.dst = dst self.length = header_length * 4 + self.option = option @classmethod def parser(cls, buf): @@ -55,7 +56,7 @@ class ipv4(packet_base.PacketBase): flags, offset, ttl, proto, csum, src, dst) if msg.length > ipv4._MIN_LEN: - self.extra = buf[ipv4._MIN_LEN:msg.length] + msg.option = buf[ipv4._MIN_LEN:msg.length] return msg, ipv4.get_packet_type(proto)