Commit a9f102f7 authored by Xavier Thompson's avatar Xavier Thompson

slapformat: Refactor IPv6 interface fallback

parent 3f78c68f
...@@ -973,7 +973,7 @@ class Interface(object): ...@@ -973,7 +973,7 @@ class Interface(object):
self._logger = logger self._logger = logger
self.name = str(name) self.name = str(name)
self.ipv4_local_network = ipv4_local_network self.ipv4_local_network = ipv4_local_network
self.ipv6_interface = ipv6_interface self.ipv6_interface = ipv6_interface or name
# XXX no __getinitargs__, as instances of this class are never deserialized. # XXX no __getinitargs__, as instances of this class are never deserialized.
...@@ -996,7 +996,7 @@ class Interface(object): ...@@ -996,7 +996,7 @@ class Interface(object):
def getGlobalScopeAddressList(self, tap=None): def getGlobalScopeAddressList(self, tap=None):
"""Returns currently configured global scope IPv6 addresses""" """Returns currently configured global scope IPv6 addresses"""
interface_name = self.ipv6_interface or self.name interface_name = self.ipv6_interface
try: try:
address_list = [ address_list = [
q q
...@@ -1040,7 +1040,7 @@ class Interface(object): ...@@ -1040,7 +1040,7 @@ class Interface(object):
if ipv6: if ipv6:
address_string = '%s/%s' % (address, lenNetmaskIpv6(netmask)) address_string = '%s/%s' % (address, lenNetmaskIpv6(netmask))
af = socket.AF_INET6 af = socket.AF_INET6
interface_name = self.ipv6_interface or self.name interface_name = self.ipv6_interface
else: else:
af = socket.AF_INET af = socket.AF_INET
address_string = '%s/%s' % (address, netmaskToPrefixIPv4(netmask)) address_string = '%s/%s' % (address, netmaskToPrefixIPv4(netmask))
...@@ -1148,7 +1148,7 @@ class Interface(object): ...@@ -1148,7 +1148,7 @@ class Interface(object):
NoAddressOnInterface: There's no address on the interface to construct NoAddressOnInterface: There's no address on the interface to construct
an address with. an address with.
""" """
interface_name = self.ipv6_interface or self.name interface_name = self.ipv6_interface
# Getting one address of the interface as base of the next addresses # Getting one address of the interface as base of the next addresses
interface_addr_list = self.getGlobalScopeAddressList() interface_addr_list = self.getGlobalScopeAddressList()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment