From d7d526ad21993646bfec68daca8c544ecce094bd Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Sat, 11 Aug 2018 18:46:28 +0200 Subject: 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 Reviewed-by: IWASE Yusuke Signed-off-by: FUJITA Tomonori --- ryu/lib/ip.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- cgit v1.2.3