Hi Bill,
Thank you for your confirmation!
I've just posted patches for this issue.
The following fixes this issue and includes some improvements for ICMPv4/v6
packet libraries.
[Ryu-devel] [PATCH 0/2] packet/icmp: Avoid TypeError when calculating length
Thanks,
Iwase
On 2017年11月08日 15:39, William Fisher wrote:
Iwase,
Yes, your patch works for me.
Thanks,
-Bill
On Tue, Nov 7, 2017 at 8:59 PM, Iwase Yusuke <iwase.yusu...@gmail.com> wrote:
Hi Bill,
Thank you for reporting issue, but sorry for the delay!
Well, packet library for ICPMv6 seems to be fixed for the same issue.
I guess the same fix should be back-ported to ICMPv4.
https://github.com/osrg/ryu/blob/8185637767f870b5887a369dc569cc2933aeec34/ryu/lib/packet/icmpv6.py#L151-L155
Any way, your patch looks more concise for me.
If we don't expect "self.data = None", how about changing the default value
to "data=b''"
in __init__() method?
The following should fix this problem?
$ git diff
diff --git a/ryu/lib/packet/icmp.py b/ryu/lib/packet/icmp.py
index 1a6cd76..f5358b1 100644
--- a/ryu/lib/packet/icmp.py
+++ b/ryu/lib/packet/icmp.py
@@ -77,7 +77,7 @@ class icmp(packet_base.PacketBase):
return cls
return _register_icmp_type
- def __init__(self, type_=ICMP_ECHO_REQUEST, code=0, csum=0, data=None):
+ def __init__(self, type_=ICMP_ECHO_REQUEST, code=0, csum=0, data=b''):
super(icmp, self).__init__()
self.type = type_
self.code = code
@@ -103,7 +103,7 @@ class icmp(packet_base.PacketBase):
hdr = bytearray(struct.pack(icmp._PACK_STR, self.type,
self.code, self.csum))
- if self.data is not None:
+ if self.data:
if self.type in icmp._ICMP_TYPES:
hdr += self.data.serialize()
else:
Thanks,
Iwase
On 2017年11月04日 15:44, William Fisher wrote:
Hi,
There is a TypeError exception with Ryu parsing fragmented ICMPv4
packets of a certain length. The attached program
"ryu_icmpv4_test.py" demonstrates the failure. Note that the packet
data is for the second fragment of a large ICMP echo.
The file "ryu_icmpv4.patch" contains a superficial patch for this issue.
It looks like Ryu attempts to parse the higher layers of an IPv4
packet even when the IP fragment offset is > 0. This is a separate
issue that I did not change.
Regards,
-Bill
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel