summaryrefslogtreecommitdiff
path: root/python/vyos
diff options
context:
space:
mode:
Diffstat (limited to 'python/vyos')
-rw-r--r--python/vyos/validate.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/python/vyos/validate.py b/python/vyos/validate.py
index 1b77f196a..8def0a510 100644
--- a/python/vyos/validate.py
+++ b/python/vyos/validate.py
@@ -94,7 +94,9 @@ def is_subnet_connected(subnet, primary=False):
# Check every assigned IP address if it is connected to the subnet
# in question
for ip in netifaces.ifaddresses(interface)[addr_type]:
- if ipaddress.ip_address(ip['addr']) in ipaddress.ip_network(subnet):
+ # remove interface extension (e.g. %eth0) that gets thrown on the end of _some_ addrs
+ addr = ip['addr'].split('%')[0]
+ if ipaddress.ip_address(addr) in ipaddress.ip_network(subnet):
return True
return False