From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 5EE6B1FF0DA for ; Thu, 19 Nov 2026 20:41:28 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 3E09021700; Thu, 19 Nov 2026 20:41:26 +0100 (CET) From: Gabriel Goller To: pve-devel@lists.proxmox.com Subject: [PATCH pve-common v3 01/28] interfaces: preserve VRF membership across address family changes Date: Thu, 19 Nov 2026 20:40:47 +0100 Message-ID: <20261119194116.575520-2-g.goller@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261119194116.575520-1-g.goller@proxmox.com> References: <20261119194116.575520-1-g.goller@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1795117281225 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.242 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: QBTBMFBBSFVW73H3ZNCV66ZSQMJ2N2Q2 X-Message-ID-Hash: QBTBMFBBSFVW73H3ZNCV66ZSQMJ2N2Q2 X-MailFrom: g.goller@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Store VRF membership as an interface option, not an address family option. Otherwise, switching from IPv4 to IPv6-only can drop the VRF assignment when the IPv4 stanza is removed. Signed-off-by: Gabriel Goller --- src/PVE/Network/Interfaces.pm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/PVE/Network/Interfaces.pm b/src/PVE/Network/Interfaces.pm index 8aed1ab3c473..1737ec5c014b 100644 --- a/src/PVE/Network/Interfaces.pm +++ b/src/PVE/Network/Interfaces.pm @@ -134,7 +134,7 @@ my $check_mtu = sub($ifaces, $parent, $child) { # gateway6 => IP, # comments6 => [ "..." ], # -# , # like bridge_ports, ovs_* +# , # interface-wide (shared by inet/inet6): bridge_ports, ovs_*, vrf # # # extra/unknown options stored by-family: # options => { ... } @@ -226,6 +226,7 @@ sub __read_etc_network_interfaces($fh, $ip_links = undef, $active_ifaces = undef my $simple_options = { 'mtu' => 1, + 'vrf' => 1, 'ovs_type' => 1, 'ovs_options' => 1, 'ovs_bridge' => 1, @@ -885,6 +886,7 @@ sub __write_etc_network_interfaces($config, $ifupdown2 = undef) { my $n = $ifaces->{$p}; $n->{autostart} = 1; die "OVS bond '$iface' - unable to find slave '$p'\n" if !$n; + die "OVS bond '$iface' - slave '$p' cannot have a VRF master\n" if $n->{vrf}; die "OVS bond '$iface' - wrong interface type on slave '$p' ('$n->{type}' != 'eth')\n" if $n->{type} ne 'eth'; @@ -893,6 +895,13 @@ sub __write_etc_network_interfaces($config, $ifupdown2 = undef) { } } + # OVS interfaces are not supported in VRFs + foreach my $iface (keys %$ifaces) { + my $d = $ifaces->{$iface}; + die "iface '$iface' - VRF is not supported on OVS interfaces\n" + if $d->{vrf} && $d->{type} =~ m/^OVS/; + } + # check bond foreach my $iface (keys %$ifaces) { my $d = $ifaces->{$iface}; @@ -904,6 +913,7 @@ sub __write_etc_network_interfaces($config, $ifupdown2 = undef) { $n->{autostart} = 1; die "bond '$iface' - unable to find slave '$p'\n" if !$n; + die "bond '$iface' - slave '$p' cannot have a VRF master\n" if $n->{vrf}; die "bond '$iface' - wrong interface type on slave '$p' ('$n->{type}' != 'eth or bond')\n" if ($n->{type} ne 'eth' && $n->{type} ne 'bond'); @@ -1027,6 +1037,7 @@ sub __write_etc_network_interfaces($config, $ifupdown2 = undef) { } my $n = $ifaces_copy->{$p}; die "bridge '$iface' - unable to find bridge port '$p'\n" if !$n; + die "bridge '$iface' - port '$p' cannot have a VRF master\n" if $n->{vrf}; die "iface $p - ip address can't be set on interface if bridged in $iface\n" if ($n->{method} && $n->{method} eq 'static' && $n->{address} ne '0.0.0.0') || ($n->{method6} && $n->{method6} eq 'static' && $n->{address6} ne '::'); -- 2.47.3