* Mon Sep 18 2023 Camilla Conte <cconte@redhat.com> - 23.1.1-11
- ci-net-fix-ipv6_dhcpv6_stateful-stateless-slaac-configu.patch [bz#2046491] - Resolves: bz#2046491 (cloud-init enable both DHCPv4 and DHCPv6 when network type is ipv6_dhcpv6-stateful/ipv6_dhcpv6-stateless) - Resolves: RHEL-2325 ([RHEL8.9][cloud-init] Not inform user during upgrade that cloud-init generated config files are left )
This commit is contained in:
parent
44fadc4471
commit
9aa4e685df
131
ci-net-fix-ipv6_dhcpv6_stateful-stateless-slaac-configu.patch
Normal file
131
ci-net-fix-ipv6_dhcpv6_stateful-stateless-slaac-configu.patch
Normal file
@ -0,0 +1,131 @@
|
||||
From 293b0716532127a7a4e8923870adcffe2480347e Mon Sep 17 00:00:00 2001
|
||||
From: Ani Sinha <anisinha@redhat.com>
|
||||
Date: Thu, 7 Sep 2023 02:36:52 +0530
|
||||
Subject: [PATCH 1/2] net: fix ipv6_dhcpv6_stateful/stateless/slaac
|
||||
configuration for rhel (#4395)
|
||||
|
||||
RH-Author: Ani Sinha <None>
|
||||
RH-MergeRequest: 109: net: fix ipv6_dhcpv6_stateful/stateless/slaac configuration for rhel (#4395)
|
||||
RH-Bugzilla: 2046491
|
||||
RH-Acked-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
|
||||
RH-Acked-by: Jon Maloy <jmaloy@redhat.com>
|
||||
RH-Commit: [1/1] e1774cc44c166bc94901c04fd5dabda006357f5e (anisinha/rhel-cloud-init)
|
||||
|
||||
When network type is ipv6_dhcpv6-stateful/stateless/slaac, cloud-init seems to
|
||||
enable dhcp for both ipv4 and ipv6. Network manager prefers dhcp over ipv4 and
|
||||
hence dhcp6 is not used to obtain the IP address. This is incorrect.
|
||||
For only ipv6_dhcpv6-stateful/stateless/slaac networks, we should set:
|
||||
|
||||
ipv4.method = disabled // disables all ipv4 dhcp
|
||||
|
||||
For ifcfg files (sysconfig renderer), the corresponding changes should be:
|
||||
BOOTPROTO = none // instead of dhcp so that dhcp4 is disabled.
|
||||
|
||||
Additionally, for only ipv6_dhcpv6_stateful, we should set:
|
||||
ipv6.may-fail = no // dhcp6 must succeed.
|
||||
|
||||
which translates to the following ifcfg setting:
|
||||
IPV6_FAILURE_FATAL = yes // so that dhcp6 should succeed.
|
||||
|
||||
This patch fixes this for rhel. The patch has been tested by Red Hat QE.
|
||||
|
||||
RHBZ: 2046491
|
||||
fixes: f550c8765ca03d3 ("Adding BOOTPROTO = dhcp to render sysconfig dhcp6 stateful on RHEL (#685)")
|
||||
|
||||
Signed-off-by: Ani Sinha <anisinha@redhat.com>
|
||||
(cherry picked from commit fd214a1243011275c5dffb92b481c235e4c7a1bf)
|
||||
---
|
||||
cloudinit/net/network_manager.py | 9 +++++++++
|
||||
cloudinit/net/sysconfig.py | 6 +++---
|
||||
tests/unittests/test_net.py | 9 ++++++++-
|
||||
3 files changed, 20 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/cloudinit/net/network_manager.py b/cloudinit/net/network_manager.py
|
||||
index 8047f796..7a32691e 100644
|
||||
--- a/cloudinit/net/network_manager.py
|
||||
+++ b/cloudinit/net/network_manager.py
|
||||
@@ -105,6 +105,14 @@ class NMConnection:
|
||||
if self.config[family]["method"] == "auto" and method == "manual":
|
||||
return
|
||||
|
||||
+ if (
|
||||
+ subnet_type == "ipv6_dhcpv6-stateful"
|
||||
+ or subnet_type == "ipv6_dhcpv6-stateless"
|
||||
+ or subnet_type == "ipv6_slaac"
|
||||
+ ):
|
||||
+ # set ipv4 method to 'disabled' to align with sysconfig renderer.
|
||||
+ self._set_default("ipv4", "method", "disabled")
|
||||
+
|
||||
self.config[family]["method"] = method
|
||||
self._set_default(family, "may-fail", "false")
|
||||
|
||||
@@ -342,6 +350,7 @@ class Renderer(renderer.Renderer):
|
||||
|
||||
def __init__(self, config=None):
|
||||
self.connections = {}
|
||||
+ self.config = config
|
||||
|
||||
def get_conn(self, con_id):
|
||||
return self.connections[con_id]
|
||||
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
|
||||
index 421564ee..6385ff78 100644
|
||||
--- a/cloudinit/net/sysconfig.py
|
||||
+++ b/cloudinit/net/sysconfig.py
|
||||
@@ -435,13 +435,13 @@ class Renderer(renderer.Renderer):
|
||||
iface_cfg["BOOTPROTO"] = "dhcp6"
|
||||
iface_cfg["DHCLIENT6_MODE"] = "managed"
|
||||
# only if rhel AND dhcpv6 stateful
|
||||
- elif (
|
||||
- flavor == "rhel" and subnet_type == "ipv6_dhcpv6-stateful"
|
||||
+ elif flavor == "rhel" and (
|
||||
+ subnet_type == "ipv6_dhcpv6-stateful"
|
||||
):
|
||||
- iface_cfg["BOOTPROTO"] = "dhcp"
|
||||
iface_cfg["DHCPV6C"] = True
|
||||
iface_cfg["IPV6INIT"] = True
|
||||
iface_cfg["IPV6_AUTOCONF"] = False
|
||||
+ iface_cfg["IPV6_FAILURE_FATAL"] = True
|
||||
else:
|
||||
iface_cfg["IPV6INIT"] = True
|
||||
# Configure network settings using DHCPv6
|
||||
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
|
||||
index aa4098b8..12b70587 100644
|
||||
--- a/tests/unittests/test_net.py
|
||||
+++ b/tests/unittests/test_net.py
|
||||
@@ -1750,6 +1750,9 @@ NETWORK_CONFIGS = {
|
||||
method=auto
|
||||
may-fail=false
|
||||
|
||||
+ [ipv4]
|
||||
+ method=disabled
|
||||
+
|
||||
"""
|
||||
),
|
||||
},
|
||||
@@ -1860,6 +1863,9 @@ NETWORK_CONFIGS = {
|
||||
method=auto
|
||||
may-fail=false
|
||||
|
||||
+ [ipv4]
|
||||
+ method=disabled
|
||||
+
|
||||
"""
|
||||
),
|
||||
},
|
||||
@@ -1907,11 +1913,12 @@ NETWORK_CONFIGS = {
|
||||
"expected_sysconfig_rhel": {
|
||||
"ifcfg-iface0": textwrap.dedent(
|
||||
"""\
|
||||
- BOOTPROTO=dhcp
|
||||
+ BOOTPROTO=none
|
||||
DEVICE=iface0
|
||||
DHCPV6C=yes
|
||||
IPV6INIT=yes
|
||||
IPV6_AUTOCONF=no
|
||||
+ IPV6_FAILURE_FATAL=yes
|
||||
IPV6_FORCE_ACCEPT_RA=yes
|
||||
DEVICE=iface0
|
||||
ONBOOT=yes
|
||||
--
|
||||
2.41.0
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
Name: cloud-init
|
||||
Version: 23.1.1
|
||||
Release: 10%{?dist}
|
||||
Release: 11%{?dist}
|
||||
Summary: Cloud instance init scripts
|
||||
|
||||
Group: System Environment/Base
|
||||
@ -54,6 +54,8 @@ Patch28: ci-logging-keep-current-file-mode-of-log-file-if-its-st.patch
|
||||
Patch29: ci-DS-VMware-modify-a-few-log-level-4284.patch
|
||||
# For bz#2229460 - [rhel-8.9] [RFE] Configure "ipv6.addr-gen-mode=eui64' as default in NetworkManager
|
||||
Patch30: ci-NM-renderer-set-default-IPv6-addr-gen-mode-for-all-i.patch
|
||||
# For bz#2046491 - cloud-init enable both DHCPv4 and DHCPv6 when network type is ipv6_dhcpv6-stateful/ipv6_dhcpv6-stateless
|
||||
Patch31: ci-net-fix-ipv6_dhcpv6_stateful-stateless-slaac-configu.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
@ -222,16 +224,19 @@ fi
|
||||
%postun
|
||||
%systemd_postun cloud-config.service cloud-config.target cloud-final.service cloud-init.service cloud-init.target cloud-init-local.service
|
||||
|
||||
if [ -f /etc/ssh/sshd_config.d/50-cloud-init.conf ] ; then
|
||||
echo "/etc/ssh/sshd_config.d/50-cloud-init.conf not removed"
|
||||
fi
|
||||
if [ $1 -eq 0 ] ; then
|
||||
# warn during package removal not upgrade
|
||||
if [ -f /etc/ssh/sshd_config.d/50-cloud-init.conf ] ; then
|
||||
echo "/etc/ssh/sshd_config.d/50-cloud-init.conf not removed"
|
||||
fi
|
||||
|
||||
if [ -f /etc/NetworkManager/conf.d/99-cloud-init.conf ] ; then
|
||||
echo "/etc/NetworkManager/conf.d/99-cloud-init.conf not removed"
|
||||
fi
|
||||
if [ -f /etc/NetworkManager/conf.d/99-cloud-init.conf ] ; then
|
||||
echo "/etc/NetworkManager/conf.d/99-cloud-init.conf not removed"
|
||||
fi
|
||||
|
||||
if [ -f /etc/NetworkManager/conf.d/30-cloud-init-ip6-addr-gen-mode.conf ] ; then
|
||||
echo "/etc/NetworkManager/conf.d/30-cloud-init-ip6-addr-gen-mode.conf not removed"
|
||||
if [ -f /etc/NetworkManager/conf.d/30-cloud-init-ip6-addr-gen-mode.conf ] ; then
|
||||
echo "/etc/NetworkManager/conf.d/30-cloud-init-ip6-addr-gen-mode.conf not removed"
|
||||
fi
|
||||
fi
|
||||
|
||||
%files
|
||||
@ -272,6 +277,13 @@ fi
|
||||
%config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf
|
||||
|
||||
%changelog
|
||||
* Mon Sep 18 2023 Camilla Conte <cconte@redhat.com> - 23.1.1-11
|
||||
- ci-net-fix-ipv6_dhcpv6_stateful-stateless-slaac-configu.patch [bz#2046491]
|
||||
- Resolves: bz#2046491
|
||||
(cloud-init enable both DHCPv4 and DHCPv6 when network type is ipv6_dhcpv6-stateful/ipv6_dhcpv6-stateless)
|
||||
- Resolves: RHEL-2325
|
||||
([RHEL8.9][cloud-init] Not inform user during upgrade that cloud-init generated config files are left )
|
||||
|
||||
* Fri Aug 25 2023 Camilla Conte <cconte@redhat.com> - 23.1.1-10
|
||||
- Resolves: bz#2233047
|
||||
([RHEL 8.9] Inform user when cloud-init generated config files are left during uninstalling)
|
||||
|
Loading…
Reference in New Issue
Block a user