2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-26 19:40:12 +00:00

Remove IPv6 portion of IPv4 address

If it is presented as an IPv6 compatible IPv4 address,
make it a normal IP address.
This commit is contained in:
Jarrod Johnson 2020-02-27 16:59:32 -05:00
parent 29b4045817
commit a066f061c7

View File

@ -59,6 +59,8 @@ def ip_on_same_subnet(first, second, prefix):
def address_is_local(address):
if '.' in address and address.startswith('::ffff:'):
address = address.replace('::ffff:', '')
for iface in netifaces.interfaces():
for i4 in netifaces.ifaddresses(iface).get(2, []):
cidr = mask_to_cidr(i4['netmask'])