mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Support for IPv6 addresses scopes in network.interfaces
This commit is contained in:
parent
2bb09b7ee7
commit
edce034e6c
1 changed files with 7 additions and 4 deletions
|
@ -402,6 +402,7 @@ def _interfaces_ip(out):
|
|||
based on the current set of cols
|
||||
'''
|
||||
brd = None
|
||||
scope = None
|
||||
if '/' in value: # we have a CIDR in this address
|
||||
ip, cidr = value.split('/') # pylint: disable=C0103
|
||||
else:
|
||||
|
@ -414,7 +415,8 @@ def _interfaces_ip(out):
|
|||
brd = cols[cols.index('brd') + 1]
|
||||
elif type_ == 'inet6':
|
||||
mask = cidr
|
||||
return (ip, mask, brd)
|
||||
scope = cols[cols.index('scope') + 1]
|
||||
return (ip, mask, brd, scope)
|
||||
|
||||
groups = re.compile('\r?\n\\d').split(out)
|
||||
for group in groups:
|
||||
|
@ -441,7 +443,7 @@ def _interfaces_ip(out):
|
|||
iflabel = cols[-1:][0]
|
||||
if type_ in ('inet', 'inet6'):
|
||||
if 'secondary' not in cols:
|
||||
ipaddr, netmask, broadcast = parse_network(value, cols)
|
||||
ipaddr, netmask, broadcast, scope = parse_network(value, cols)
|
||||
if type_ == 'inet':
|
||||
if 'inet' not in data:
|
||||
data['inet'] = list()
|
||||
|
@ -457,11 +459,12 @@ def _interfaces_ip(out):
|
|||
addr_obj = dict()
|
||||
addr_obj['address'] = ipaddr
|
||||
addr_obj['prefixlen'] = netmask
|
||||
addr_obj['scope'] = scope
|
||||
data['inet6'].append(addr_obj)
|
||||
else:
|
||||
if 'secondary' not in data:
|
||||
data['secondary'] = list()
|
||||
ip_, mask, brd = parse_network(value, cols)
|
||||
ip_, mask, brd, scp = parse_network(value, cols)
|
||||
data['secondary'].append({
|
||||
'type': type_,
|
||||
'address': ip_,
|
||||
|
@ -469,7 +472,7 @@ def _interfaces_ip(out):
|
|||
'broadcast': brd,
|
||||
'label': iflabel,
|
||||
})
|
||||
del ip_, mask, brd
|
||||
del ip_, mask, brd, scp
|
||||
elif type_.startswith('link'):
|
||||
data['hwaddr'] = value
|
||||
if iface:
|
||||
|
|
Loading…
Add table
Reference in a new issue