Skip to content

Instantly share code, notes, and snippets.

@jimi-c
Created September 10, 2013 05:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimi-c/6505277 to your computer and use it in GitHub Desktop.
Save jimi-c/6505277 to your computer and use it in GitHub Desktop.
diff --git a/library/system/setup b/library/system/setup
index e39910f..d21bc71 100644
--- a/library/system/setup
+++ b/library/system/setup
@@ -1443,21 +1443,23 @@ class LinuxNetwork(Network):
netmask = socket.inet_ntoa(struct.pack('!L', netmask_bin))
network = socket.inet_ntoa(struct.pack('!L', address_bin & netmask_bin))
iface = words[-1]
- if iface != device:
- interfaces[iface] = {}
- interfaces[iface].update(interfaces[device])
- interfaces[iface]['ipv4'] = {'address': address,
- '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['netmask'] = netmask
- default_ipv4['network'] = network
- default_ipv4['macaddress'] = macaddress
- default_ipv4['mtu'] = interfaces[device]['mtu']
- default_ipv4['type'] = interfaces[device].get("type", "unknown")
- default_ipv4['alias'] = words[-1]
+ if "secondary" not in words:
+ if iface != device:
+ interfaces[iface] = {}
+ interfaces[iface].update(interfaces[device])
+
+ interfaces[iface]['ipv4'] = {'address': address,
+ '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['netmask'] = netmask
+ default_ipv4['network'] = network
+ default_ipv4['macaddress'] = macaddress
+ default_ipv4['mtu'] = interfaces[device]['mtu']
+ default_ipv4['type'] = interfaces[device].get("type", "unknown")
+ default_ipv4['alias'] = words[-1]
if not address.startswith('127.'):
ips['all_ipv4_addresses'].append(address)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment