backport upstream bugfix patches

This commit is contained in:
dongyuzhen 2024-09-05 14:26:35 +08:00
parent 923cf335c6
commit e4b7566e87
3 changed files with 133 additions and 1 deletions

View File

@ -0,0 +1,94 @@
From 2c09f69173d448118b02e013518bf5f1674d3c1f Mon Sep 17 00:00:00 2001
From: Alexsander de Souza <61709370+alexsander-souza@users.noreply.github.com>
Date: Thu, 27 Jun 2024 12:24:50 -0300
Subject: [PATCH] fix(net): klibc ipconfig PROTO compatibility (#5437)
klibc's ipconfig format [1] states that PROTO values 'none', 'off',
'static' and blank all mean no autoconfiguration, but cloud-init parser
is too strict and accepts only the first.
Reference:https://github.com/canonical/cloud-init/commit/2c09f69173d448118b02e013518bf5f1674d3c1f
Conflict:not change tools/.github-cla-signers
LP: #2065787
[1] https://git.kernel.org/pub/scm/libs/klibc/klibc.git/plain/usr/kinit/ipconfig/README.ipconfig
---
cloudinit/net/cmdline.py | 3 +++
tests/unittests/test_net.py | 39 +++++++++++++++++++++++++++++++++++--
2 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/cloudinit/net/cmdline.py b/cloudinit/net/cmdline.py
index 48714e9..23febfe 100644
--- a/cloudinit/net/cmdline.py
+++ b/cloudinit/net/cmdline.py
@@ -127,6 +127,9 @@ def _klibc_to_config_entry(content, mac_addrs=None):
else:
proto = "none"
+ if proto in ("static", "off"):
+ proto = "none"
+
if proto not in ("none", "dhcp", "dhcp6"):
raise ValueError("Unexpected value for PROTO: %s" % proto)
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
index 73a4c91..68e2e94 100644
--- a/tests/unittests/test_net.py
+++ b/tests/unittests/test_net.py
@@ -134,6 +134,37 @@ STATIC_EXPECTED_1 = {
],
}
+STATIC_CONTENT_2 = """
+DEVICE='eth1'
+PROTO='static'
+IPV4ADDR='10.0.0.2'
+IPV4BROADCAST='10.0.0.255'
+IPV4NETMASK='255.255.255.0'
+IPV4GATEWAY='10.0.0.1'
+IPV4DNS0='10.0.1.1'
+IPV4DNS1='0.0.0.0'
+HOSTNAME='foohost'
+UPTIME='21'
+DHCPLEASETIME='3600'
+DOMAINSEARCH='foo.com'
+"""
+
+STATIC_CONTENT_3 = """
+DEVICE='eth1'
+PROTO='off'
+IPV4ADDR='10.0.0.2'
+IPV4BROADCAST='10.0.0.255'
+IPV4NETMASK='255.255.255.0'
+IPV4GATEWAY='10.0.0.1'
+IPV4DNS0='10.0.1.1'
+IPV4DNS1='0.0.0.0'
+HOSTNAME='foohost'
+UPTIME='21'
+DHCPLEASETIME='3600'
+DOMAINSEARCH='foo.com'
+"""
+
+
V1_NAMESERVER_ALIAS = """
config:
- id: eno1
@@ -6891,8 +6922,12 @@ class TestCmdlineConfigParsing(CiTestCase):
self.assertEqual(found, ("eno1", DHCP6_EXPECTED_1))
def test_cmdline_convert_static(self):
- found = cmdline._klibc_to_config_entry(STATIC_CONTENT_1)
- self.assertEqual(found, ("eth1", STATIC_EXPECTED_1))
+ found1 = cmdline._klibc_to_config_entry(STATIC_CONTENT_1)
+ assert found1 == ("eth1", STATIC_EXPECTED_1)
+ found2 = cmdline._klibc_to_config_entry(STATIC_CONTENT_2)
+ assert found2 == ("eth1", STATIC_EXPECTED_1)
+ found3 = cmdline._klibc_to_config_entry(STATIC_CONTENT_3)
+ assert found3 == ("eth1", STATIC_EXPECTED_1)
def test_config_from_cmdline_net_cfg(self):
files = []
--
2.43.0

View File

@ -0,0 +1,29 @@
From 12f1198e8e9e884363b14eeaaf6eb69b7199c36a Mon Sep 17 00:00:00 2001
From: Curt Moore <curt.moore@garmin.com>
Date: Tue, 4 Jun 2024 14:37:43 -0500
Subject: [PATCH] fix(openstack): Fix bond mac_address (#5369)
Reference:https://github.com/canonical/cloud-init/commit/12f1198e8e9e884363b14eeaaf6eb69b7199c36a
Conflict:tools/.github-cla-signers not change.
Fixes GH-5368
---
cloudinit/sources/helpers/openstack.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cloudinit/sources/helpers/openstack.py b/cloudinit/sources/helpers/openstack.py
index d2260ba..ef29eb7 100644
--- a/cloudinit/sources/helpers/openstack.py
+++ b/cloudinit/sources/helpers/openstack.py
@@ -663,7 +663,7 @@ def convert_net_json(network_json=None, known_macs=None):
if link["type"] in ["bond"]:
params = {}
if link_mac_addr:
- params["mac_address"] = link_mac_addr
+ cfg.update({"mac_address": link_mac_addr})
for k, v in link.items():
if k == "bond_links":
continue
--
2.43.0

View File

@ -1,6 +1,6 @@
Name: cloud-init Name: cloud-init
Version: 23.4.1 Version: 23.4.1
Release: 7 Release: 8
Summary: the defacto multi-distribution package that handles early initialization of a cloud instance. Summary: the defacto multi-distribution package that handles early initialization of a cloud instance.
License: ASL 2.0 or GPLv3 License: ASL 2.0 or GPLv3
URL: http://launchpad.net/cloud-init URL: http://launchpad.net/cloud-init
@ -27,6 +27,8 @@ Patch6009: backport-fix-azure-disable-use-dns-for-secondary-nics-5314.patch
Patch6010: backport-fix-net-Make-duplicate-route-add-succeed.-5343.patch Patch6010: backport-fix-net-Make-duplicate-route-add-succeed.-5343.patch
Patch6011: backport-fix-netplan-Fix-predictable-interface-rename-issue-5.patch Patch6011: backport-fix-netplan-Fix-predictable-interface-rename-issue-5.patch
Patch6012: backport-fix-Fall-back-to-cached-local-ds-if-no-valid-ds-foun.patch Patch6012: backport-fix-Fall-back-to-cached-local-ds-if-no-valid-ds-foun.patch
Patch6013: backport-fix-openstack-Fix-bond-mac_address-5369.patch
Patch6014: backport-fix-net-klibc-ipconfig-PROTO-compatibility-5437.patch
Patch9000: do-not-generate-dsa.patch Patch9000: do-not-generate-dsa.patch
@ -159,6 +161,13 @@ fi
%exclude /usr/share/doc/* %exclude /usr/share/doc/*
%changelog %changelog
* Thu Sep 5 2024 dongyuzhen <dongyuzhen@h-partners.com> - 23.4.1-8
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:fix(net): klibc ipconfig PROTO compatibility
fix(openstack): Fix bond mac_address
* Sat Jul 20 2024 shixuantong <shixuantong1@huawei.com> - 23.4.1-7 * Sat Jul 20 2024 shixuantong <shixuantong1@huawei.com> - 23.4.1-7
- Type:bugfix - Type:bugfix
- CVE:NA - CVE:NA