From: Guillaume via pve-devel <pve-devel@lists.proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Guillaume <09couplet.bitmap@icloud.com>
Subject: [pve-devel] [PATCH container v2 4/4] setup: disabled ipv4 or ipv6 if not used in NetworkManager files
Date: Mon, 1 Sep 2025 18:20:36 +0200 [thread overview]
Message-ID: <mailman.101.1756743748.418.pve-devel@lists.proxmox.com> (raw)
In-Reply-To: <20250901162036.2651-1-09couplet.bitmap@icloud.com>
[-- Attachment #1: Type: message/rfc822, Size: 9011 bytes --]
From: Guillaume <09couplet.bitmap@icloud.com>
To: pve-devel@lists.proxmox.com
Cc: Guillaume <09couplet.bitmap@icloud.com>
Subject: [PATCH container v2 4/4] setup: disabled ipv4 or ipv6 if not used in NetworkManager files
Date: Mon, 1 Sep 2025 18:20:36 +0200
Message-ID: <20250901162036.2651-5-09couplet.bitmap@icloud.com>
Signed-off-by: Guillaume <09couplet.bitmap@icloud.com>
---
src/PVE/LXC/Setup/CentOS.pm | 12 ++++++++----
.../system-connections/eth0.nmconnection.exp | 2 ++
.../system-connections/eth0.nmconnection.exp | 2 ++
.../system-connections/eth1.nmconnection.exp | 2 ++
.../system-connections/eth2.nmconnection.exp | 2 ++
5 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/PVE/LXC/Setup/CentOS.pm b/src/PVE/LXC/Setup/CentOS.pm
index 06b4dac..42119ea 100644
--- a/src/PVE/LXC/Setup/CentOS.pm
+++ b/src/PVE/LXC/Setup/CentOS.pm
@@ -229,8 +229,8 @@ sub setup_netork_with_networkmanager {
my $header = "[connection]\nid=$d->{name}\nuuid=" . UUID::uuid() . "\ntype=ethernet\ninterface-name=$d->{name}\n";
my $data = '';
+ $data .= "[ipv4]\n";
if ($d->{ip} && $d->{ip} ne 'manual') {
- $data .= "[ipv4]\n";
if ($d->{ip} eq 'dhcp') {
$data .= "method=auto\n";
} else {
@@ -245,10 +245,12 @@ sub setup_netork_with_networkmanager {
}
$data .= "dns=" . join(',', @nameserversv4) . "\n" if @nameserversv4;
$data .= "dns-search=" . join(' ', PVE::Tools::split_list($searchdomains)) . "\n" if @nameserversv4 && $searchdomains;
- }
+ } else {
+ $data .= "method=disabled\n";
+ }
+ $data .= "[ipv6]\n";
if ($d->{ip6} && $d->{ip6} ne 'manual') {
- $data .= "[ipv6]\n";
if ($d->{ip6} eq 'auto' || $d->{ip6} eq 'dhcp') {
$data .= "method=auto\n";
} else {
@@ -266,7 +268,9 @@ sub setup_netork_with_networkmanager {
}
$data .= "dns=" . join(',', @nameserversv6) . "\n" if @nameserversv6;
$data .= "dns-search=" . join(' ', PVE::Tools::split_list($searchdomains)) . "\n" if @nameserversv6 && $searchdomains;
- }
+ } else {
+ $data .= "method=disabled\n";
+ }
next unless $data;
$self->ct_file_set_contents($filename, $header . $data, 0600);
diff --git a/src/test/test-centos10-001/etc/NetworkManager/system-connections/eth0.nmconnection.exp b/src/test/test-centos10-001/etc/NetworkManager/system-connections/eth0.nmconnection.exp
index 25a907d..3bf5d2d 100644
--- a/src/test/test-centos10-001/etc/NetworkManager/system-connections/eth0.nmconnection.exp
+++ b/src/test/test-centos10-001/etc/NetworkManager/system-connections/eth0.nmconnection.exp
@@ -7,3 +7,5 @@ interface-name=eth0
method=auto
dns=127.0.0.1
dns-search=example.com
+[ipv6]
+method=disabled
diff --git a/src/test/test-centos10-002/etc/NetworkManager/system-connections/eth0.nmconnection.exp b/src/test/test-centos10-002/etc/NetworkManager/system-connections/eth0.nmconnection.exp
index c6c5417..49b0aed 100644
--- a/src/test/test-centos10-002/etc/NetworkManager/system-connections/eth0.nmconnection.exp
+++ b/src/test/test-centos10-002/etc/NetworkManager/system-connections/eth0.nmconnection.exp
@@ -10,3 +10,5 @@ gateway=11.0.0.1
routes=11.0.0.1
dns=127.0.0.1
dns-search=example.com
+[ipv6]
+method=disabled
diff --git a/src/test/test-centos10-002/etc/NetworkManager/system-connections/eth1.nmconnection.exp b/src/test/test-centos10-002/etc/NetworkManager/system-connections/eth1.nmconnection.exp
index a99b707..271f928 100644
--- a/src/test/test-centos10-002/etc/NetworkManager/system-connections/eth1.nmconnection.exp
+++ b/src/test/test-centos10-002/etc/NetworkManager/system-connections/eth1.nmconnection.exp
@@ -3,6 +3,8 @@ id=eth1
uuid=00000000-0000-0000-0000-000000000000
type=ethernet
interface-name=eth1
+[ipv4]
+method=disabled
[ipv6]
method=manual
address=fc00::1/64
diff --git a/src/test/test-centos10-002/etc/NetworkManager/system-connections/eth2.nmconnection.exp b/src/test/test-centos10-002/etc/NetworkManager/system-connections/eth2.nmconnection.exp
index 53a6df6..1a4a900 100644
--- a/src/test/test-centos10-002/etc/NetworkManager/system-connections/eth2.nmconnection.exp
+++ b/src/test/test-centos10-002/etc/NetworkManager/system-connections/eth2.nmconnection.exp
@@ -8,3 +8,5 @@ method=manual
addresses=192.168.0.1/24
dns=127.0.0.1
dns-search=example.com
+[ipv6]
+method=disabled
--
2.47.2
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
prev parent reply other threads:[~2025-09-01 16:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250901162036.2651-1-09couplet.bitmap@icloud.com>
2025-09-01 16:20 ` [pve-devel] SPAM: [PATCH container v2 1/4] setup: add underscore in regex to parse systemd version Guillaume via pve-devel
2025-09-01 16:20 ` [pve-devel] [PATCH container v2 2/4] setup: add support of el10 and implementing NetworkManager instead fo network-scripts Guillaume via pve-devel
2025-09-01 16:20 ` [pve-devel] SPAM: [PATCH container v2 3/4] tests: add tests for centos 10 Guillaume via pve-devel
2025-09-01 16:20 ` Guillaume via pve-devel [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=mailman.101.1756743748.418.pve-devel@lists.proxmox.com \
--to=pve-devel@lists.proxmox.com \
--cc=09couplet.bitmap@icloud.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox