Signed-off-by: Yuichi Ito <[email protected]>
---
ryu/lib/packet/icmp.py | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/ryu/lib/packet/icmp.py b/ryu/lib/packet/icmp.py
index e383e21..d3d4cdd 100644
--- a/ryu/lib/packet/icmp.py
+++ b/ryu/lib/packet/icmp.py
@@ -115,6 +115,9 @@ class icmp(packet_base.PacketBase):
return hdr
+ def __len__(self):
+ return self._MIN_LEN + len(self.data)
+
@icmp.register_icmp_type(ICMP_ECHO_REPLY, ICMP_ECHO_REQUEST)
class echo(stringify.StringifyMixin):
@@ -167,6 +170,12 @@ class echo(stringify.StringifyMixin):
return hdr
+ def __len__(self):
+ length = self._MIN_LEN
+ if self.data is not None:
+ length += len(self.data)
+ return length
+
@icmp.register_icmp_type(ICMP_DEST_UNREACH)
class dest_unreach(stringify.StringifyMixin):
@@ -227,6 +236,12 @@ class dest_unreach(stringify.StringifyMixin):
return hdr
+ def __len__(self):
+ length = self._MIN_LEN
+ if self.data is not None:
+ length += len(self.data)
+ return length
+
@icmp.register_icmp_type(ICMP_TIME_EXCEEDED)
class TimeExceeded(stringify.StringifyMixin):
@@ -276,3 +291,9 @@ class TimeExceeded(stringify.StringifyMixin):
hdr += 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