1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

dhcp: add support for inet + inet6 dhcp on same interface

Ticket: CM-12370
Reviewed By: Roopa, Kanna, Scott E
Testing Done:

This patch also fixes a problem where dhcp6 used to create lease file with
a trailing whitespace. dhcp6 operation were also sometimes using the wrong
pid file. I added some code in the debian.postinst script to correctly
rename these files if they exists when we install/update ifupdown2.

(cumulus-qa-infra/cl-tests/tests/smoke/testdhcp.py:Testdhcp_relay)
auto swp1
iface swp1 inet dhcp
      link-speed 10000
      link-duplex full
      link-autoneg off

auto swp1
iface swp1 inet6 dhcp

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
This commit is contained in:
Julien Fortin
2016-11-15 18:33:07 +01:00
parent 99b652303f
commit 004d1e6585
7 changed files with 88 additions and 45 deletions

View File

@@ -94,20 +94,20 @@ class networkInterfaces():
self.warns += 1
def _validate_addr_family(self, ifaceobj, lineno=-1):
if ifaceobj.addr_family:
if not self._addrfams.get(ifaceobj.addr_family):
for family in ifaceobj.addr_family:
if not self._addrfams.get(family):
self._parse_error(self._currentfile, lineno,
'iface %s: unsupported address family \'%s\''
%(ifaceobj.name, ifaceobj.addr_family))
ifaceobj.addr_family = None
'iface %s: unsupported address family \'%s\''
% (ifaceobj.name, family))
ifaceobj.addr_family = []
ifaceobj.addr_method = None
return
if ifaceobj.addr_method:
if (ifaceobj.addr_method not in
self._addrfams.get(ifaceobj.addr_family)):
if ifaceobj.addr_method not in self._addrfams.get(family):
self._parse_error(self._currentfile, lineno,
'iface %s: unsupported address method \'%s\''
%(ifaceobj.name, ifaceobj.addr_method))
'iface %s: unsupported '
'address method \'%s\''
% (ifaceobj.name, ifaceobj.addr_method))
else:
ifaceobj.addr_method = 'static'
@@ -285,7 +285,8 @@ class networkInterfaces():
ifaceobj.generate_env()
try:
ifaceobj.addr_family = iface_attrs[2]
if iface_attrs[2]:
ifaceobj.addr_family.append(iface_attrs[2])
ifaceobj.addr_method = iface_attrs[3]
except IndexError:
# ignore