From 9ee223bc97ba0d9081639f9cbb7331b5ea95ff8a Mon Sep 17 00:00:00 2001 From: Miroslav Rezanina Date: Tue, 14 Dec 2021 00:44:13 -0500 Subject: [PATCH] * Tue Dec 14 2021 Miroslav Rezanina - 21.1-14 - ci-cloudinit-net-handle-two-different-routes-for-the-sa.patch [bz#2028031] - Resolves: bz#2028031 ([RHEL-9] Above 19.2 of cloud-init fails to configure routes when configuring static and default routes to the same destination IP) --- ...ndle-two-different-routes-for-the-sa.patch | 87 +++++++++++++++++++ cloud-init.spec | 9 +- 2 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 ci-cloudinit-net-handle-two-different-routes-for-the-sa.patch diff --git a/ci-cloudinit-net-handle-two-different-routes-for-the-sa.patch b/ci-cloudinit-net-handle-two-different-routes-for-the-sa.patch new file mode 100644 index 0000000..3eafc72 --- /dev/null +++ b/ci-cloudinit-net-handle-two-different-routes-for-the-sa.patch @@ -0,0 +1,87 @@ +From e0eca40388080dabf6598c0d9653ea50ae10c984 Mon Sep 17 00:00:00 2001 +From: Emanuele Giuseppe Esposito +Date: Tue, 7 Dec 2021 10:04:43 +0100 +Subject: [PATCH] cloudinit/net: handle two different routes for the same ip + (#1124) + +RH-Author: Emanuele Giuseppe Esposito +RH-MergeRequest: 15: cloudinit/net: handle two different routes for the same ip (#1124) +RH-Commit: [1/1] b623a76ccd642e22e8d9c4aebc26f0b0cec8118b (eesposit/cloud-init-centos-) +RH-Bugzilla: 2028031 +RH-Acked-by: Mohamed Gamal Morsy +RH-Acked-by: Eduardo Otubo + +commit 0e25076b34fa995161b83996e866c0974cee431f +Author: Emanuele Giuseppe Esposito +Date: Mon Dec 6 18:34:26 2021 +0100 + + cloudinit/net: handle two different routes for the same ip (#1124) + + If we set a dhcp server side like this: + $ cat /var/tmp/cloud-init/cloud-init-dhcp-f0rie5tm/dhcp.leases + lease { + ... + option classless-static-routes 31.169.254.169.254 0.0.0.0,31.169.254.169.254 + 10.112.143.127,22.10.112.140 0.0.0.0,0 10.112.140.1; + ... + } + cloud-init fails to configure the routes via 'ip route add' because to there are + two different routes for 169.254.169.254: + + $ ip -4 route add 192.168.1.1/32 via 0.0.0.0 dev eth0 + $ ip -4 route add 192.168.1.1/32 via 10.112.140.248 dev eth0 + + But NetworkManager can handle such scenario successfully as it uses "ip route append". + So change cloud-init to also use "ip route append" to fix the issue: + + $ ip -4 route append 192.168.1.1/32 via 0.0.0.0 dev eth0 + $ ip -4 route append 192.168.1.1/32 via 10.112.140.248 dev eth0 + + Signed-off-by: Emanuele Giuseppe Esposito + + RHBZ: #2003231 + +Conflicts: + cloudinit/net/tests/test_init.py: a mock call in + test_ephemeral_ipv4_network_with_rfc3442_static_routes is not + present downstream. + +Signed-off-by: Emanuele Giuseppe Esposito +--- + cloudinit/net/__init__.py | 2 +- + cloudinit/net/tests/test_init.py | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py +index de65e7af..4bdc1bda 100644 +--- a/cloudinit/net/__init__.py ++++ b/cloudinit/net/__init__.py +@@ -1076,7 +1076,7 @@ class EphemeralIPv4Network(object): + if gateway != "0.0.0.0/0": + via_arg = ['via', gateway] + subp.subp( +- ['ip', '-4', 'route', 'add', net_address] + via_arg + ++ ['ip', '-4', 'route', 'append', net_address] + via_arg + + ['dev', self.interface], capture=True) + self.cleanup_cmds.insert( + 0, ['ip', '-4', 'route', 'del', net_address] + via_arg + +diff --git a/cloudinit/net/tests/test_init.py b/cloudinit/net/tests/test_init.py +index 0535387a..6754df8d 100644 +--- a/cloudinit/net/tests/test_init.py ++++ b/cloudinit/net/tests/test_init.py +@@ -715,10 +715,10 @@ class TestEphemeralIPV4Network(CiTestCase): + ['ip', '-family', 'inet', 'link', 'set', 'dev', 'eth0', 'up'], + capture=True), + mock.call( +- ['ip', '-4', 'route', 'add', '169.254.169.254/32', ++ ['ip', '-4', 'route', 'append', '169.254.169.254/32', + 'via', '192.168.2.1', 'dev', 'eth0'], capture=True), + mock.call( +- ['ip', '-4', 'route', 'add', '0.0.0.0/0', ++ ['ip', '-4', 'route', 'append', '0.0.0.0/0', + 'via', '192.168.2.1', 'dev', 'eth0'], capture=True)] + expected_teardown_calls = [ + mock.call( +-- +2.27.0 + diff --git a/cloud-init.spec b/cloud-init.spec index 3c36547..3193490 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -1,6 +1,6 @@ Name: cloud-init Version: 21.1 -Release: 13%{?dist} +Release: 14%{?dist} Summary: Cloud instance init scripts License: ASL 2.0 or GPLv3 URL: http://launchpad.net/cloud-init @@ -32,6 +32,8 @@ Patch12: ci-cc_ssh.py-fix-private-key-group-owner-and-permission.patch Patch13: ci-remove-unnecessary-EOF-string-in-disable-sshd-keygen.patch # For bz#2028381 - cloud-init.service fails to start after package update Patch14: ci-fix-error-on-upgrade-caused-by-new-vendordata2-attri.patch +# For bz#2028031 - [RHEL-9] Above 19.2 of cloud-init fails to configure routes when configuring static and default routes to the same destination IP +Patch15: ci-cloudinit-net-handle-two-different-routes-for-the-sa.patch # Source-git patches @@ -229,6 +231,11 @@ fi %config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf %changelog +* Tue Dec 14 2021 Miroslav Rezanina - 21.1-14 +- ci-cloudinit-net-handle-two-different-routes-for-the-sa.patch [bz#2028031] +- Resolves: bz#2028031 + ([RHEL-9] Above 19.2 of cloud-init fails to configure routes when configuring static and default routes to the same destination IP) + * Mon Dec 06 2021 Miroslav Rezanina - 21.1-13 - ci-fix-error-on-upgrade-caused-by-new-vendordata2-attri.patch [bz#2028381] - Resolves: bz#2028381