Signed-off-by: Yuichi Ito <[email protected]>
---
ryu/lib/packet/icmpv6.py | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/ryu/lib/packet/icmpv6.py b/ryu/lib/packet/icmpv6.py
index 5d4146f..bcf1fff 100644
--- a/ryu/lib/packet/icmpv6.py
+++ b/ryu/lib/packet/icmpv6.py
@@ -138,6 +138,12 @@ class icmpv6(packet_base.PacketBase):
return hdr
+ def __len__(self):
+ length = self._MIN_LEN
+ if self.data is not None:
+ length += len(self.data)
+ return length
+
@icmpv6.register_icmpv6_type(ND_NEIGHBOR_SOLICIT, ND_NEIGHBOR_ADVERT)
class nd_neighbor(stringify.StringifyMixin):
@@ -206,6 +212,12 @@ class nd_neighbor(stringify.StringifyMixin):
hdr.extend(self.option)
return str(hdr)
+ def __len__(self):
+ length = self._MIN_LEN
+ if self.option is not None:
+ length += len(self.option)
+ return length
+
@icmpv6.register_icmpv6_type(ND_ROUTER_SOLICIT)
class nd_router_solicit(stringify.StringifyMixin):
@@ -269,6 +281,12 @@ class nd_router_solicit(stringify.StringifyMixin):
hdr.extend(self.option)
return str(hdr)
+ def __len__(self):
+ length = self._MIN_LEN
+ if self.option is not None:
+ length += len(self.option)
+ return length
+
@icmpv6.register_icmpv6_type(ND_ROUTER_ADVERT)
class nd_router_advert(stringify.StringifyMixin):
@@ -348,6 +366,12 @@ class nd_router_advert(stringify.StringifyMixin):
hdr.extend(option)
return str(hdr)
+ def __len__(self):
+ length = self._MIN_LEN
+ for option in self.options:
+ length += len(option)
+ return length
+
class nd_option(stringify.StringifyMixin):
@@ -372,6 +396,9 @@ class nd_option(stringify.StringifyMixin):
def serialize(self):
pass
+ def __len__(self):
+ return self._MIN_LEN
+
class nd_option_la(nd_option):
@@ -405,6 +432,12 @@ class nd_option_la(nd_option):
buf.extend(bytearray(8 - mod))
return str(buf)
+ def __len__(self):
+ length = self._MIN_LEN
+ if self.data is not None:
+ length += len(self.data)
+ return length
+
@nd_neighbor.register_nd_option_type
@nd_router_solicit.register_nd_option_type
@@ -594,3 +627,9 @@ class echo(stringify.StringifyMixin):
hdr += bytearray(self.data)
return hdr
+
+ def __len__(self):
+ length = self._MIN_LEN
+ if self.data is not None:
+ length += len(self.data)
+ return length
--
1.7.10.4
------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel