Support reading multiple addresses from interface files.

This commit is contained in:
Michael Lustfield 2018-08-28 21:24:56 -05:00 committed by Ch3LL
parent 15c34fe7a2
commit 622c354683
No known key found for this signature in database
GPG Key ID: 132B55A7C13EFA73

View File

@ -629,7 +629,12 @@ def _parse_interfaces(interface_files=None):
attrname = attr
(valid, value, errmsg) = _validate_interface_option(
attr, valuestr, addrfam)
iface_dict[attrname] = value
if attrname == 'address' and 'address' in iface_dict:
if 'addresses' not in iface_dict:
iface_dict['addresses'] = []
iface_dict['addresses'].append(value)
else:
iface_dict[attrname] = value
elif attr in _REV_ETHTOOL_CONFIG_OPTS:
if 'ethtool' not in iface_dict:
@ -1710,11 +1715,6 @@ def build_interface(iface, iface_type, enabled, **settings):
if 'proto' not in settings:
settings['proto'] = 'static'
if 'ipv6ipaddr' not in settings and 'ipv6ipaddrs' in settings:
settings['ipv6ipaddr'] = settings['ipv6ipaddrs'].pop(0)
if 'ipaddr' not in settings and 'ipaddrs' in settings:
settings['ipaddr'] = settings['ipaddrs'].pop(0)
if iface_type == 'slave':
settings['slave'] = 'yes'
if 'master' not in settings: