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 (ifconfig)
This commit is contained in:
parent
4d929071e1
commit
bc36d05c0c
2 changed files with 12 additions and 5 deletions
|
@ -498,7 +498,7 @@ def _interfaces_ifconfig(out):
|
|||
else:
|
||||
pip = re.compile(r'.*?(?:inet addr:|inet )(.*?)\s')
|
||||
pip6 = re.compile('.*?(?:inet6 addr: (.*?)/|inet6 )([0-9a-fA-F:]+)')
|
||||
pmask6 = re.compile(r'.*?(?:inet6 addr: [0-9a-fA-F:]+/(\d+)|prefixlen (\d+)).*')
|
||||
pmask6 = re.compile(r'.*?(?:inet6 addr: [0-9a-fA-F:]+/(\d+)|prefixlen (\d+))(?: Scope:([a-zA-Z]+)| scopeid (0x[0-9a-fA-F]))?')
|
||||
pmask = re.compile(r'.*?(?:Mask:|netmask )(?:((?:0x)?[0-9a-fA-F]{8})|([\d\.]+))')
|
||||
pupdown = re.compile('UP')
|
||||
pbcast = re.compile(r'.*?(?:Bcast:|broadcast )([\d\.]+)')
|
||||
|
@ -545,6 +545,9 @@ def _interfaces_ifconfig(out):
|
|||
mmask6 = pmask6.match(line)
|
||||
if mmask6:
|
||||
addr_obj['prefixlen'] = mmask6.group(1) or mmask6.group(2)
|
||||
if not salt.utils.is_sunos():
|
||||
ipv6scope = mmask6.group(3) or mmask6.group(4)
|
||||
addr_obj['scope'] = ipv6scope.lower() if ipv6scope is not None else ipv6scope
|
||||
data['inet6'].append(addr_obj)
|
||||
data['up'] = updown
|
||||
if iface in ret:
|
||||
|
|
|
@ -101,12 +101,14 @@ class NetworkTestCase(TestCase):
|
|||
'broadcast': '10.10.10.255',
|
||||
'netmask': '255.255.252.0'}],
|
||||
'inet6': [{'address': 'fe80::e23f:49ff:fe85:6aaf',
|
||||
'prefixlen': '64'}],
|
||||
'prefixlen': '64',
|
||||
'scope': 'link'}],
|
||||
'up': True},
|
||||
'lo': {'inet': [{'address': '127.0.0.1',
|
||||
'netmask': '255.0.0.0'}],
|
||||
'inet6': [{'address': '::1',
|
||||
'prefixlen': '128'}],
|
||||
'prefixlen': '128',
|
||||
'scope': 'host'}],
|
||||
'up': True}}
|
||||
)
|
||||
|
||||
|
@ -127,9 +129,11 @@ class NetworkTestCase(TestCase):
|
|||
'lo0': {'inet': [{'address': '127.0.0.1',
|
||||
'netmask': '255.0.0.0'}],
|
||||
'inet6': [{'address': 'fe80::1',
|
||||
'prefixlen': '64'},
|
||||
'prefixlen': '64',
|
||||
'scope': '0x8'},
|
||||
{'address': '::1',
|
||||
'prefixlen': '128'}],
|
||||
'prefixlen': '128',
|
||||
'scope': None}],
|
||||
'up': True},
|
||||
'plip0': {'up': False},
|
||||
'tun0': {'inet': [{'address': '10.12.0.1',
|
||||
|
|
Loading…
Add table
Reference in a new issue