[pve-devel] [PATCH pve-common 2/2] iproute2: add helpers for detecting vlan-aware bridges
Stefan Hanreich
s.hanreich at proxmox.com
Wed Dec 10 19:42:32 CET 2025
These helpers will initially be used in pve-manager's pve-sdn-commit
service, that reloads the SDN configuration if uncommitted changes are
detected. For non-vlan aware bridges, the SDN configuration might need
to get updated if there were changes to the names of the physical
interfaces enslaved to that bridge. pve-sdn-commit uses the helpers
introduced in this commit for that.
Signed-off-by: Stefan Hanreich <s.hanreich at proxmox.com>
---
src/PVE/IPRoute2.pm | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/src/PVE/IPRoute2.pm b/src/PVE/IPRoute2.pm
index 5f7b94c..5208d93 100644
--- a/src/PVE/IPRoute2.pm
+++ b/src/PVE/IPRoute2.pm
@@ -32,6 +32,25 @@ sub ip_link_is_physical($ip_link) {
&& (!defined($ip_link->{linkinfo}) || !defined($ip_link->{linkinfo}->{info_kind}));
}
+sub ip_link_is_bridge($ip_link) {
+ return
+ defined($ip_link->{linkinfo})
+ && defined($ip_link->{linkinfo}->{info_kind})
+ && $ip_link->{linkinfo}->{info_kind} eq 'bridge';
+}
+
+sub bridge_is_vlan_aware($ip_link) {
+ if (!ip_link_is_bridge($ip_link)) {
+ warn "passed link that isn't a bridge to bridge_is_vlan_aware";
+ return 0;
+ }
+
+ return
+ defined($ip_link->{linkinfo}->{info_data})
+ && defined($ip_link->{linkinfo}->{info_data}->{vlan_filtering})
+ && $ip_link->{linkinfo}->{info_data}->{vlan_filtering} == 1;
+}
+
sub ip_link_is_bridge_member($ip_link) {
return
defined($ip_link->{linkinfo})
--
2.47.3
More information about the pve-devel
mailing list