Skip to content

Commit

Permalink
Fix convertion of ipv4 to string on i386 and arch
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
slawqo authored and fujita committed Aug 14, 2018
1 parent 8312ab2 commit d7d526a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ryu/lib/ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d7d526a

Please sign in to comment.