summaryrefslogtreecommitdiff
path: root/cloudinit/net
diff options
context:
space:
mode:
authorDimitri John Ledkov <xnox@ubuntu.com>2020-01-30 17:15:49 +0000
committerGitHub <noreply@github.com>2020-01-30 12:15:49 -0500
commit2bedc44092ec94faebfb2f55c6d7c6bdd754df23 (patch)
tree49f015315e3e840edbee0a0fc23fb168fda7912d /cloudinit/net
parent5f8f85bb38cc972d3d2c705a1ec73db3f690f323 (diff)
downloadvyos-cloud-init-2bedc44092ec94faebfb2f55c6d7c6bdd754df23.tar.gz
vyos-cloud-init-2bedc44092ec94faebfb2f55c6d7c6bdd754df23.zip
net/cmdline: correctly handle static ip= config (#201)
It is proto 'none', not 'static' as was mistakenly implemented in initramfs-tools/cloud-init in the past, yet was never the case in the klibc ipconfig state file output. LP: #1861412
Diffstat (limited to 'cloudinit/net')
-rwxr-xr-xcloudinit/net/cmdline.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/cloudinit/net/cmdline.py b/cloudinit/net/cmdline.py
index bfb40aae..64e1c699 100755
--- a/cloudinit/net/cmdline.py
+++ b/cloudinit/net/cmdline.py
@@ -101,9 +101,12 @@ def _klibc_to_config_entry(content, mac_addrs=None):
provided here. There is no good documentation on this unfortunately.
DEVICE=<name> is expected/required and PROTO should indicate if
- this is 'static' or 'dhcp' or 'dhcp6' (LP: #1621507).
+ this is 'none' (static) or 'dhcp' or 'dhcp6' (LP: #1621507).
note that IPV6PROTO is also written by newer code to address the
possibility of both ipv4 and ipv6 getting addresses.
+
+ Full syntax is documented at:
+ https://git.kernel.org/pub/scm/libs/klibc/klibc.git/plain/usr/kinit/ipconfig/README.ipconfig
"""
if mac_addrs is None:
@@ -122,9 +125,9 @@ def _klibc_to_config_entry(content, mac_addrs=None):
if data.get('filename'):
proto = 'dhcp'
else:
- proto = 'static'
+ proto = 'none'
- if proto not in ('static', 'dhcp', 'dhcp6'):
+ if proto not in ('none', 'dhcp', 'dhcp6'):
raise ValueError("Unexpected value for PROTO: %s" % proto)
iface = {
@@ -144,6 +147,9 @@ def _klibc_to_config_entry(content, mac_addrs=None):
# PROTO for ipv4, IPV6PROTO for ipv6
cur_proto = data.get(pre + 'PROTO', proto)
+ # ipconfig's 'none' is called 'static'
+ if cur_proto == 'none':
+ cur_proto = 'static'
subnet = {'type': cur_proto, 'control': 'manual'}
# only populate address for static types. While the rendered config