1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
Add missing broadcast addr for network facts for Linux
This commit is contained in:
Vitaliy Okulov 2015-05-10 14:37:46 +00:00
parent bc4d51a4fd
commit ad9981f565

View file

@ -1836,6 +1836,7 @@ class LinuxNetwork(Network):
if words[0] == 'inet':
if '/' in words[1]:
address, netmask_length = words[1].split('/')
broadcast = words[3]
else:
# pointopoint interfaces do not have a prefix
address = words[1]
@ -1849,6 +1850,7 @@ class LinuxNetwork(Network):
interfaces[iface] = {}
if not secondary and "ipv4" not in interfaces[iface]:
interfaces[iface]['ipv4'] = {'address': address,
'broadcast': broadcast,
'netmask': netmask,
'network': network}
else:
@ -1856,6 +1858,7 @@ class LinuxNetwork(Network):
interfaces[iface]["ipv4_secondaries"] = []
interfaces[iface]["ipv4_secondaries"].append({
'address': address,
'broadcast': broadcast,
'netmask': netmask,
'network': network,
})
@ -1866,12 +1869,14 @@ class LinuxNetwork(Network):
interfaces[device]["ipv4_secondaries"] = []
interfaces[device]["ipv4_secondaries"].append({
'address': address,
'broadcast': broadcast,
'netmask': netmask,
'network': network,
})
# If this is the default address, update default_ipv4
if 'address' in default_ipv4 and default_ipv4['address'] == address:
default_ipv4['broadcast'] = broadcast
default_ipv4['netmask'] = netmask
default_ipv4['network'] = network
default_ipv4['macaddress'] = macaddress