public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-common 2/2] iproute2: add helpers for detecting vlan-aware bridges
Date: Wed, 10 Dec 2025 19:42:32 +0100	[thread overview]
Message-ID: <20251210184236.448600-3-s.hanreich@proxmox.com> (raw)
In-Reply-To: <20251210184236.448600-1-s.hanreich@proxmox.com>

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@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


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  parent reply	other threads:[~2025-12-10 18:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-10 18:42 [pve-devel] [PATCH common/manager/network 0/4] trixie: fix VLAN handling on vlan-unaware bridges with pinned NIC names Stefan Hanreich
2025-12-10 18:42 ` [pve-devel] [PATCH pve-common 1/2] fix #7118: fix bridge port detection when plugging netdev with vlan Stefan Hanreich
2025-12-10 18:42 ` Stefan Hanreich [this message]
2025-12-10 19:29   ` [pve-devel] applied: [PATCH pve-common 2/2] iproute2: add helpers for detecting vlan-aware bridges Thomas Lamprecht
2025-12-10 18:42 ` [pve-devel] [PATCH pve-manager 1/1] pve-sdn-commit: run for vlan/qinq zones on non-vlan-aware bridges Stefan Hanreich
2025-12-10 18:42 ` [pve-devel] [PATCH pve-network 1/1] fix #6806: vlan: qinq: fix bridge port detection Stefan Hanreich
2025-12-10 19:32   ` [pve-devel] applied: " 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=20251210184236.448600-3-s.hanreich@proxmox.com \
    --to=s.hanreich@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