Merge pull request #10971 from mightydok/debbraoadcastfix

Add missed broadcast address to linux network facts.
pull/12935/head
Brian Coca 9 years ago
commit 262c75c253

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

Loading…
Cancel
Save