public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH installer 2/2] install: do not force gateway to IPv6 RA-received on non-bridged setups
Date: Wed, 10 Jun 2026 15:27:02 +0200	[thread overview]
Message-ID: <20260610132710.199825-2-c.heiss@proxmox.com> (raw)
In-Reply-To: <20260610132710.199825-1-c.heiss@proxmox.com>

Skip writing the default gateway for the management interface to
/etc/network/interfaces if it was originally received through an IPv6
RA.

Otherwise, fresh, non-bridged (aka. anything other than PVE)
installations will repeatedly, i.e. on every received RA advertising a
different SLAAC-capable prefix, report an error in the journal that a
default gateway already exists.

The Rust struct definitions are not touched, as the information is not
needed there (yet).

Suggested-by: Gabriel Goller <g.goller@proxmox.com>
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
 Proxmox/Install.pm                             | 18 +++++++++++++-----
 Proxmox/Sys/Net.pm                             |  6 ++++++
 ...dn_from_dhcp_no_default_domain.run-env.json |  3 ++-
 .../no_fqdn_from_dhcp.run-env.json             |  3 ++-
 .../tests/resources/run-env-info.json          |  3 ++-
 5 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/Proxmox/Install.pm b/Proxmox/Install.pm
index 5f748d6..d025360 100644
--- a/Proxmox/Install.pm
+++ b/Proxmox/Install.pm
@@ -1182,6 +1182,12 @@ sub extract_data {
             }
         }
 
+        my $routes = $run_env->{network}->{routes};
+        my $is_gateway6_from_ra =
+            defined($routes->{gateway6})
+            && $routes->{gateway6}->{gateway} eq $gateway
+            && $routes->{gateway6}->{protocol} eq 'ra';
+
         if ($iso_env->{cfg}->{bridged_network}) {
             $ifaces .= "iface $ethdev $ntype manual\n";
 
@@ -1193,11 +1199,13 @@ sub extract_data {
                 . "\tbridge-stp off\n"
                 . "\tbridge-fd 0\n";
         } else {
-            $ifaces .=
-                "auto $ethdev\n"
-                . "iface $ethdev $ntype static\n"
-                . "\taddress $cidr\n"
-                . "\tgateway $gateway\n";
+            $ifaces .= "auto $ethdev\n" . #
+                "iface $ethdev $ntype static\n" . #
+                "\taddress $cidr\n";
+
+            if (!$is_gateway6_from_ra) {
+                $ifaces .= "\tgateway $gateway\n";
+            }
         }
 
         my $interfaces = $run_env->{network}->{interfaces};
diff --git a/Proxmox/Sys/Net.pm b/Proxmox/Sys/Net.pm
index d175742..c4fdd7b 100644
--- a/Proxmox/Sys/Net.pm
+++ b/Proxmox/Sys/Net.pm
@@ -279,12 +279,16 @@ sub query_netdevs : prototype() {
 #     gateway4 => {
 #         gateway => <ipv4>,
 #         dev => <ifname>,
+#         protocol => <protocol>,
 #     },
 #     gateway6 => {
 #         gateway => <ipv6>,
 #         dev => <ifname>,
+#         protocol => <protocol>,
 #     },
 # }
+#
+# <protocol> can be one of: "kernel", "ra"
 sub query_routes : prototype() {
     my $routes = {};
 
@@ -295,6 +299,7 @@ sub query_routes : prototype() {
             $routes->{gateway4} = {
                 dev => $route->{dev},
                 gateway => $route->{gateway},
+                protocol => $route->{protocol},
             };
             last;
         }
@@ -306,6 +311,7 @@ sub query_routes : prototype() {
             $routes->{gateway6} = {
                 dev => $route->{dev},
                 gateway => $route->{gateway},
+                protocol => $route->{protocol},
             };
             last;
         }
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/fqdn_from_dhcp_no_default_domain.run-env.json b/proxmox-auto-installer/tests/resources/parse_answer_fail/fqdn_from_dhcp_no_default_domain.run-env.json
index 566e261..3fbf2aa 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer_fail/fqdn_from_dhcp_no_default_domain.run-env.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/fqdn_from_dhcp_no_default_domain.run-env.json
@@ -177,7 +177,8 @@
     "routes": {
       "gateway4": {
         "dev": "eno1",
-        "gateway": "192.168.1.1"
+        "gateway": "192.168.1.1",
+        "protocol": "kernel"
       }
     }
   },
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/no_fqdn_from_dhcp.run-env.json b/proxmox-auto-installer/tests/resources/parse_answer_fail/no_fqdn_from_dhcp.run-env.json
index 909cd7c..58cd634 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer_fail/no_fqdn_from_dhcp.run-env.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/no_fqdn_from_dhcp.run-env.json
@@ -176,7 +176,8 @@
     "routes": {
       "gateway4": {
         "dev": "eno1",
-        "gateway": "192.168.1.1"
+        "gateway": "192.168.1.1",
+        "protocol": "kernel"
       }
     }
   },
diff --git a/proxmox-auto-installer/tests/resources/run-env-info.json b/proxmox-auto-installer/tests/resources/run-env-info.json
index 55c4fe0..321e7e8 100644
--- a/proxmox-auto-installer/tests/resources/run-env-info.json
+++ b/proxmox-auto-installer/tests/resources/run-env-info.json
@@ -177,7 +177,8 @@
     "routes": {
       "gateway4": {
         "dev": "eno1",
-        "gateway": "192.168.1.1"
+        "gateway": "192.168.1.1",
+        "protocol": "kernel"
       }
     }
   },
-- 
2.54.0





  reply	other threads:[~2026-06-10 13:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-10 13:27 [PATCH installer 1/2] sys: net: make routes hash always defined Christoph Heiss
2026-06-10 13:27 ` Christoph Heiss [this message]
2026-06-10 14:38   ` [PATCH installer 2/2] install: do not force gateway to IPv6 RA-received on non-bridged setups Gabriel Goller
2026-06-10 14:46   ` Gabriel Goller
2026-06-10 19:41 ` applied: [PATCH installer 1/2] sys: net: make routes hash always defined Thomas Lamprecht

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=20260610132710.199825-2-c.heiss@proxmox.com \
    --to=c.heiss@proxmox.com \
    --cc=pve-devel@lists.proxmox.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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal