summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSlawek Kaplonski <skaplons@redhat.com>2018-08-11 18:46:28 +0200
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-08-14 06:17:01 -0700
commitd7d526ad21993646bfec68daca8c544ecce094bd (patch)
tree04c711edb2a57c5488ea28c30417db2a1bf33a94
parent8312ab23b389d1c2da9c722954c237278b4ee898 (diff)
Fix convertion of ipv4 to string on i386 and arch
On architectures like i386 or arm convertion of IPv4 to string was failing in some cases. It was like that because some integer values were converted to long which is not the case on x86_64. It was like that for example with value "2871386400" which is used in ryu.tests.unit.ofproto.test_parser_v10:TestOFPMatch unit test. Because of that this test was failing when running on architectures where integer range was too small to handle this value. Signed-off-by: Slawek Kaplonski <skaplons@redhat.com> Reviewed-by: IWASE Yusuke <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/lib/ip.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/ryu/lib/ip.py b/ryu/lib/ip.py
index c4094b9a..c75de162 100644
--- a/ryu/lib/ip.py
+++ b/ryu/lib/ip.py
@@ -84,7 +84,7 @@ def ipv4_to_str(ip):
:param ip: binary or int type representation of IPv4 address
:return: IPv4 address string
"""
- if isinstance(ip, int):
+ if isinstance(ip, numbers.Integral):
return addrconv.ipv4.bin_to_text(struct.pack("!I", ip))
else:
return addrconv.ipv4.bin_to_text(ip)