From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH installer v4 14/30] install: config: add option for setting up vlan on management interface
Date: Mon, 2 Nov 2026 13:45:20 +0100 [thread overview]
Message-ID: <20261102124539.1008075-15-c.heiss@proxmox.com> (raw)
In-Reply-To: <20261102124539.1008075-1-c.heiss@proxmox.com>
Prerequisite for the rest of the installer to support setting up a VLAN
interface for management during installation.
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
Changes v3 -> v4:
* no changes
Changes v2 -> v3:
* new patch
Proxmox/Install/Config.pm | 32 ++++++++++++++++++++++++++++++++
Proxmox/Sys/Net.pm | 9 +++++++++
2 files changed, 41 insertions(+)
diff --git a/Proxmox/Install/Config.pm b/Proxmox/Install/Config.pm
index 967712a..3df66c2 100644
--- a/Proxmox/Install/Config.pm
+++ b/Proxmox/Install/Config.pm
@@ -118,6 +118,13 @@ my sub init_cfg {
primary_interface => undef,
},
+ # Options for setting up a VLAN on the management interface.
+ mngmt_vlan => {
+ enabled => 0,
+ # VLAN ID to configure.
+ vid => 0,
+ },
+
# maps mac address -> custom name
# if set to a hash, enables interface name pinning for all interfaces
network_interface_pin_map => undef,
@@ -304,6 +311,31 @@ sub get_mngmt_bond_enabled { # virtual config
return scalar(get_mngmt_bond_opt('members')->@*) >= 2;
}
+sub set_mngmt_vlan_opt {
+ my ($k, $v) = @_;
+ my $opts = get('mngmt_vlan');
+
+ croak "unknown management vlan option key '$k'\n" if !exists($opts->{$k});
+
+ if ($k eq 'vid') {
+ die "invalid VLAN tag '$v'\n"
+ if !Proxmox::Sys::Net::is_valid_vlan_id($v);
+ $opts->{$k} = int($v);
+ } else {
+ $opts->{$k} = $v;
+ }
+}
+
+sub get_mngmt_vlan_opt {
+ my ($k) = @_;
+ my $opts = get('mngmt_vlan');
+ return defined($k) ? $opts->{$k} : $opts;
+}
+
+sub get_mngmt_vlan_enabled {
+ return get_mngmt_vlan_opt('enabled') != 0;
+}
+
sub set_network_interface_pin_map { set_key('network_interface_pin_map', $_[0]); }
sub get_network_interface_pin_map { return get('network_interface_pin_map'); }
diff --git a/Proxmox/Sys/Net.pm b/Proxmox/Sys/Net.pm
index 630d96a..485c9e9 100644
--- a/Proxmox/Sys/Net.pm
+++ b/Proxmox/Sys/Net.pm
@@ -17,6 +17,7 @@ our @EXPORT_OK = qw(
validate_link_pin_map
is_valid_bond_mode
is_valid_bond_hash_policy
+ is_valid_vlan_id
MIN_IFNAME_LEN
MAX_IFNAME_LEN
DEFAULT_PIN_PREFIX
@@ -484,4 +485,12 @@ sub is_valid_bond_hash_policy {
return exists($valid->{$policy});
}
+# Returns whether the given ID is a valid VLAN ID.
+# 0 and 4095 are reserved, and 1 is the default PVID of VLAN-aware bridges on Linux.
+sub is_valid_vlan_id {
+ my ($vid) = @_;
+
+ return defined($vid) && $vid =~ m/^[0-9]+$/ && $vid >= 2 && $vid <= 4094;
+}
+
1;
--
2.55.0
next prev parent reply other threads:[~2026-11-02 12:47 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 12:45 [PATCH installer/proxmox v4 00/30] fix #2164: add bond setup across all installers Christoph Heiss
2026-11-02 12:45 ` [PATCH proxmox v4 01/30] installer-types: clippy: use .is_multiple_of() instead of manual modulo Christoph Heiss
2026-11-02 12:45 ` [PATCH proxmox v4 02/30] installer-types: use `MacAddress` type where applicable Christoph Heiss
2026-11-02 12:45 ` [PATCH proxmox v4 03/30] installer-types: derive Display for RebootMode and FilterMatch Christoph Heiss
2026-11-02 12:45 ` [PATCH proxmox v4 04/30] installer-types: answer: add options for configuring management bond Christoph Heiss
2026-11-02 12:45 ` [PATCH proxmox v4 05/30] installer-types: answer: add options for configuring management vlan Christoph Heiss
2026-11-02 12:45 ` [PATCH proxmox v4 06/30] installer-types: bump fetch schema for bond and VLAN answer options Christoph Heiss
2026-11-02 12:45 ` [PATCH proxmox v4 07/30] installer-types: bump version to 0.3.0-1 Christoph Heiss
2026-11-02 12:45 ` [PATCH proxmox v4 08/30] network-api: derive Display and FromStr for network bond types Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 09/30] install: run make tidy Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 10/30] tree-wide: use `MacAddress` type instead of string for MAC addresses Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 11/30] install: factor out ifupdown2 config generation into own subroutine Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 12/30] install: do not rely on interface name map to be fully populated Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 13/30] install: config: add option for setting up bond on management interface Christoph Heiss
2026-11-02 12:45 ` Christoph Heiss [this message]
2026-11-02 12:45 ` [PATCH installer v4 15/30] install: network: set up management bond if requested Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 16/30] install: network: set up vlan on management interface " Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 17/30] gui: network: factor out name pinning into advanced options dialog Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 18/30] gui: network: add bond setup options to " Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 19/30] gui: network: add vlan setup options to advanced network dialog Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 20/30] auto: pass through management network bond options to low-level installer Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 21/30] auto: pass through management network vlan " Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 22/30] tui: drop long obsolete comment about logo formatting Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 23/30] tui: views: add widget for displaying a group of checkboxes Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 24/30] tui: network: factor out name pinning into advanced options dialog Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 25/30] tui: network: add bond setup options to advanced network dialog Christoph Heiss
2026-11-02 14:55 ` Lukas Sichert
2026-11-02 12:45 ` [PATCH installer v4 26/30] tui: network: add vlan " Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 27/30] gui: network: split advanced options dialog into tabs Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 28/30] tui: " Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 29/30] gui: network: list bond member candidates sharing a MAC address once Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 30/30] tui: " Christoph Heiss
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=20261102124539.1008075-15-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.