From 3e15ad05f7f0384af6a29f0a7d25a23708a05c57 Mon Sep 17 00:00:00 2001
From: Slawek Kaplonski <skaplons@redhat.com>
Date: Sat, 11 Aug 2018 10:49:49 +0200
Subject: [PATCH] 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>
---
 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..7eca0ac4 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, (int, long)):
         return addrconv.ipv4.bin_to_text(struct.pack("!I", ip))
     else:
         return addrconv.ipv4.bin_to_text(ip)
-- 
2.17.1

