summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/vyos/utils/network.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/python/vyos/utils/network.py b/python/vyos/utils/network.py
index 5b75de1cc..ef8205b97 100644
--- a/python/vyos/utils/network.py
+++ b/python/vyos/utils/network.py
@@ -25,8 +25,10 @@ def _are_same_ip(one, two):
from vyos.template import is_ipv4
# compare the binary representation of the IP
f_one = AF_INET if is_ipv4(one) else AF_INET6
- s_two = AF_INET if is_ipv4(two) else AF_INET6
- return inet_pton(f_one, one) == inet_pton(f_one, two)
+ f_two = AF_INET if is_ipv4(two) else AF_INET6
+ if f_one != f_two:
+ return False
+ return inet_pton(f_one, one) == inet_pton(f_two, two)
def get_protocol_by_name(protocol_name):
"""Get protocol number by protocol name