* [PATCH network v2] sdn: zones: warn about host interfaces in a missing zone VRF
@ 2026-11-20 18:31 Gabriel Goller
2026-11-20 18:59 ` Gabriel Goller
0 siblings, 1 reply; 2+ messages in thread
From: Gabriel Goller @ 2026-11-20 18:31 UTC (permalink / raw)
To: pve-devel; +Cc: Thomas Lamprecht
Disabling dedicated-vrf, removing the node from a zone or deleting the
zone removes its VRF, but host interfaces may still be in it. ifreload
then cannot enslave them or add their gateway, which is easy to miss
in the apply log.
Warn when generating the SDN network config of the node, as only the
node sees its own interfaces file. A host stanza for the VRF only
counts if it sets vrf-table, since a stanza that just adds an address
to the SDN VRF would otherwise hide the warning once the zone is gone.
Files sourced from /etc/network/interfaces are not checked. The PVE
parser does not follow source directives, and the rest of SDN, such as
the SNAT uplink lookup, does not look at them either. A host VRF named
like a zone VRF in a sourced file therefore gives a false warning, and
an interface defined in a sourced file is not checked at all. This
seems acceptable for a best-effort warning.
Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
Changes in v2:
- Only skip the warning for a host stanza of the VRF if it sets
vrf-table. Before, any host stanza with the VRF's name hid the
warning, including one that only adds an address to the SDN VRF.
- Say in the warning that the VRF is defined neither in
/etc/network/interfaces nor in the SDN config of this node.
- Shorten the code comment and explain the sourced-files limitation in
the commit message instead.
- Link to v1: https://lore.proxmox.com/pve-devel/20261120141157.192734-1-g.goller@proxmox.com/
src/PVE/Network/SDN/Zones.pm | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/PVE/Network/SDN/Zones.pm b/src/PVE/Network/SDN/Zones.pm
index 1c90ea769a41..2a44723feec2 100644
--- a/src/PVE/Network/SDN/Zones.pm
+++ b/src/PVE/Network/SDN/Zones.pm
@@ -11,6 +11,7 @@ use PVE::Tools qw(extract_param dir_glob_regex run_command);
use PVE::Cluster qw(cfs_read_file cfs_write_file cfs_lock_file);
use PVE::IPRoute2;
use PVE::Network;
+use PVE::RESTEnvironment qw(log_warn);
use PVE::Network::SDN::Controllers;
use PVE::Network::SDN::Dns;
@@ -228,6 +229,23 @@ sub generate_etc_network_config {
}
}
+ # Warn about host interfaces in a zone VRF that is no longer generated, e.g. after the zone
+ # was deleted. Sourced files are not checked.
+ my $host_ifaces = $interfaces_config->{ifaces};
+ for my $iface (sort keys $host_ifaces->%*) {
+ my $vrf = $host_ifaces->{$iface}->{vrf};
+ next if !$vrf || $vrf !~ m/^vrf_/;
+ next if $config->{$vrf};
+
+ my $host_vrf = $host_ifaces->{$vrf} // {};
+ # make sure this is actually a VRF and isn't just named like one
+ my @options = (($host_vrf->{options} // [])->@*, ($host_vrf->{options6} // [])->@*);
+ next if grep { m/^vrf-table\s/ } @options;
+
+ log_warn("host interface '$iface' is in VRF '$vrf', which is not defined in"
+ . " /etc/network/interfaces or the SDN configuration of this node");
+ }
+
my $raw_network_config = "\#version:$version\n";
foreach my $iface (sort keys %$config) {
$raw_network_config .= "\n";
--
2.47.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH network v2] sdn: zones: warn about host interfaces in a missing zone VRF
2026-11-20 18:31 [PATCH network v2] sdn: zones: warn about host interfaces in a missing zone VRF Gabriel Goller
@ 2026-11-20 18:59 ` Gabriel Goller
0 siblings, 0 replies; 2+ messages in thread
From: Gabriel Goller @ 2026-11-20 18:59 UTC (permalink / raw)
To: pve-devel; +Cc: Thomas Lamprecht
On 20.11.2026 19:31, Gabriel Goller wrote:
> Disabling dedicated-vrf, removing the node from a zone or deleting the
> zone removes its VRF, but host interfaces may still be in it. ifreload
> then cannot enslave them or add their gateway, which is easy to miss
> in the apply log.
>
> Warn when generating the SDN network config of the node, as only the
> node sees its own interfaces file. A host stanza for the VRF only
> counts if it sets vrf-table, since a stanza that just adds an address
> to the SDN VRF would otherwise hide the warning once the zone is gone.
>
> Files sourced from /etc/network/interfaces are not checked. The PVE
> parser does not follow source directives, and the rest of SDN, such as
> the SNAT uplink lookup, does not look at them either. A host VRF named
> like a zone VRF in a sourced file therefore gives a false warning, and
> an interface defined in a sourced file is not checked at all. This
> seems acceptable for a best-effort warning.
>
> Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> ---
>
> Changes in v2:
> - Only skip the warning for a host stanza of the VRF if it sets
> vrf-table. Before, any host stanza with the VRF's name hid the
> warning, including one that only adds an address to the SDN VRF.
> - Say in the warning that the VRF is defined neither in
> /etc/network/interfaces nor in the SDN config of this node.
> - Shorten the code comment and explain the sourced-files limitation in
> the commit message instead.
> - Link to v1: https://lore.proxmox.com/pve-devel/20261120141157.192734-1-g.goller@proxmox.com/
>
> src/PVE/Network/SDN/Zones.pm | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/src/PVE/Network/SDN/Zones.pm b/src/PVE/Network/SDN/Zones.pm
> index 1c90ea769a41..2a44723feec2 100644
> --- a/src/PVE/Network/SDN/Zones.pm
> +++ b/src/PVE/Network/SDN/Zones.pm
> @@ -11,6 +11,7 @@ use PVE::Tools qw(extract_param dir_glob_regex run_command);
> use PVE::Cluster qw(cfs_read_file cfs_write_file cfs_lock_file);
> use PVE::IPRoute2;
> use PVE::Network;
> +use PVE::RESTEnvironment qw(log_warn);
>
> use PVE::Network::SDN::Controllers;
> use PVE::Network::SDN::Dns;
> @@ -228,6 +229,23 @@ sub generate_etc_network_config {
> }
> }
>
> + # Warn about host interfaces in a zone VRF that is no longer generated, e.g. after the zone
> + # was deleted. Sourced files are not checked.
> + my $host_ifaces = $interfaces_config->{ifaces};
> + for my $iface (sort keys $host_ifaces->%*) {
> + my $vrf = $host_ifaces->{$iface}->{vrf};
> + next if !$vrf || $vrf !~ m/^vrf_/;
> + next if $config->{$vrf};
> +
> + my $host_vrf = $host_ifaces->{$vrf} // {};
> + # make sure this is actually a VRF and isn't just named like one
> + my @options = (($host_vrf->{options} // [])->@*, ($host_vrf->{options6} // [])->@*);
> + next if grep { m/^vrf-table\s/ } @options;
Ah, one small fix here, which could be picked up if I don't send a new version:
- next if grep { m/^vrf-table\s/ } @options;
+ next if grep { m/^vrf[-_]table\s/ } @options;
> +
> + log_warn("host interface '$iface' is in VRF '$vrf', which is not defined in"
> + . " /etc/network/interfaces or the SDN configuration of this node");
> + }
> +
> my $raw_network_config = "\#version:$version\n";
> foreach my $iface (sort keys %$config) {
> $raw_network_config .= "\n";
> --
> 2.47.3
>
>
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-20 18:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 18:31 [PATCH network v2] sdn: zones: warn about host interfaces in a missing zone VRF Gabriel Goller
2026-11-20 18:59 ` Gabriel Goller
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.