Skip to content

Commit

Permalink
Merge pull request #322 from gthiemonge/fix-setipalias
Browse files Browse the repository at this point in the history
Fixed setipalias with IPv6 addresses
  • Loading branch information
openshift-merge-bot[bot] authored Jun 13, 2024
2 parents ac0c17f + 0b4ddd3 commit ec3f84d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions templates/octaviaamphoracontroller/bin/setipalias.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@
if ipaddr:
# Get our current addresses so we can avoid trying to set the
# same address again.
ifaceinfo = netifaces.ifaddresses(interface_name)[netifaces.AF_INET]
version = ipaddress.ip_address(ipaddr).version
ifaceinfo = netifaces.ifaddresses(interface_name)[
netifaces.AF_INET if version == 4 else netifaces.AF_INET6]
current_addresses = [x['addr'] for x in ifaceinfo]
if ipaddr not in current_addresses:
mask_value = 32
if ipaddress.ip_address(ipaddr).version == 6:
if version == 6:
mask_value = 128
ip.addr('add', index = octavia_interface[0], address=ipaddr, mask=mask_value)
ip.close()

0 comments on commit ec3f84d

Please sign in to comment.