From 3420ac44be3fe82ddb0a899a6c1516e21c34d7ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Thu, 18 Jan 2018 08:32:16 +0100 Subject: [PATCH] Fixed net to use only integers on py3 --- server/src/uds/core/util/net.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/src/uds/core/util/net.py b/server/src/uds/core/util/net.py index 791c30ade..67e9d60fb 100644 --- a/server/src/uds/core/util/net.py +++ b/server/src/uds/core/util/net.py @@ -59,12 +59,12 @@ def longToIp(n): convert long int to dotted quad string ''' try: - d = 256 * 256 * 256 + d = 1 << 24 q = [] while d > 0: m, n = divmod(n, d) - q.append(str(m)) - d = d / 256 + q.append(str(m)) # As m is an integer, this works on py2 and p3 correctly + d >>= 8 return '.'.join(q) except: @@ -97,7 +97,7 @@ def networksFromString(strNets, allowMultipleNetworks=True): val = 0 for n in args: val += start * int(n) - start /= 256 + start >>= 8 return val def maskFromBits(nBits):