all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH network/proxmox-perl-rs 0/3] Fix listing fabric nodes of hosts in multiple fabrics
@ 2026-11-20 15:22 Gabriel Goller
  2026-11-20 15:22 ` [PATCH proxmox-perl-rs 1/3] pve-rs: fabrics: list nodes of all fabrics Gabriel Goller
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Gabriel Goller @ 2026-11-20 15:22 UTC (permalink / raw)
  To: pve-devel

GET /cluster/sdn/fabrics/node returned only one node per host. The nodes
returned by list_nodes() in pve-rs were keyed by the node name, so if a
host was part of multiple fabrics, the fabric that sorts last overwrote
the others. Among others, this hid the WireGuard interfaces in the node
edit window of OSPF and BGP fabrics. The proxmox-perl-rs patch keys the
nodes by section ID (<fabric>_<node>) instead.

The API endpoints used these keys as node names for the permission check
on /nodes/<node>. GET /cluster/sdn/fabrics/all always got section IDs from
list_all(), so users with permissions only on single nodes never saw any
fabric node there. The first pve-network patch fixes this. The second
one does the same for GET /cluster/sdn/fabrics/node, which is needed with
the proxmox-perl-rs patch. It works with the old pve-rs too, so it should
be applied no later than the proxmox-perl-rs patch.


proxmox-perl-rs:

Gabriel Goller (1):
  pve-rs: fabrics: list nodes of all fabrics

 pve-rs/src/bindings/sdn/fabrics.rs | 41 ++++++++++++++++++++++++++++--
 1 file changed, 39 insertions(+), 2 deletions(-)


pve-network:

Gabriel Goller (2):
  api: fabrics: check node permissions with the node name in list_all
  api: fabrics: check node permissions with the node name in list_nodes

 src/PVE/API2/Network/SDN/Fabrics.pm      | 5 +++--
 src/PVE/API2/Network/SDN/Fabrics/Node.pm | 7 ++++---
 2 files changed, 7 insertions(+), 5 deletions(-)


Summary over all repositories:
  3 files changed, 46 insertions(+), 7 deletions(-)

-- 
Generated by murpp 0.11.0




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH proxmox-perl-rs 1/3] pve-rs: fabrics: list nodes of all fabrics
  2026-11-20 15:22 [PATCH network/proxmox-perl-rs 0/3] Fix listing fabric nodes of hosts in multiple fabrics Gabriel Goller
@ 2026-11-20 15:22 ` Gabriel Goller
  2026-11-20 15:22 ` [PATCH pve-network 2/3] api: fabrics: check node permissions with the node name in list_all Gabriel Goller
  2026-11-20 15:22 ` [PATCH pve-network 3/3] api: fabrics: check node permissions with the node name in list_nodes Gabriel Goller
  2 siblings, 0 replies; 4+ messages in thread
From: Gabriel Goller @ 2026-11-20 15:22 UTC (permalink / raw)
  To: pve-devel

The nodes of a host that is part of multiple fabrics overwrote each
other, so GET /cluster/sdn/fabrics/node only returned the node of the
fabric that sorts last for each host. Among others, the node edit
window lost the WireGuard interfaces offered for OSPF and BGP fabrics.

Fixes: 1c5f6859ad36 ("pve-rs: sdn: fabrics: add api methods")
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 pve-rs/src/bindings/sdn/fabrics.rs | 41 ++++++++++++++++++++++++++++--
 1 file changed, 39 insertions(+), 2 deletions(-)

diff --git a/pve-rs/src/bindings/sdn/fabrics.rs b/pve-rs/src/bindings/sdn/fabrics.rs
index 98c132dd7f28..caa637ac3047 100644
--- a/pve-rs/src/bindings/sdn/fabrics.rs
+++ b/pve-rs/src/bindings/sdn/fabrics.rs
@@ -232,7 +232,7 @@ pub mod pve_rs_sdn_fabrics {
             .flat_map(|entry| {
                 entry
                     .nodes()
-                    .map(|(id, node)| (id.to_string(), node.clone().into()))
+                    .map(|(_node_id, node)| (node.id().to_string(), node.clone().into()))
             })
             .collect())
     }
@@ -1221,7 +1221,11 @@ pub mod pve_rs_sdn_fabrics {
 
     #[cfg(test)]
     mod tests {
-        use super::parse_routes;
+        use std::sync::Mutex;
+
+        use proxmox_ve_config::sdn::fabric::FabricConfig;
+
+        use super::{PerlFabricConfig, parse_routes};
 
         #[test]
         fn parses_batched_routes_with_duplicate_prefixes() {
@@ -1238,6 +1242,39 @@ pub mod pve_rs_sdn_fabrics {
             assert_eq!(routes[1].vrf_name, "vrf_b");
         }
 
+        #[test]
+        fn list_nodes_returns_host_of_every_fabric() {
+            let raw = "
+wireguard_fabric: test
+
+wireguard_node: test_node1
+\tinterfaces name=wg0,listen_port=51820,public_key=rsS0GeYRbguBG1DAzc+xxQqPDvouxlKtc+c1PPEM92I=
+\trole internal
+
+ospf_fabric: underlay
+\tarea 0
+\tip_prefix 10.0.0.0/24
+
+ospf_node: underlay_node1
+\tinterfaces name=nic1
+\tip 10.0.0.1
+";
+            let config = PerlFabricConfig {
+                fabric_config: Mutex::new(
+                    FabricConfig::parse_section_config(raw)
+                        .expect("config should parse")
+                        .into_inner(),
+                ),
+            };
+
+            let nodes = super::list_nodes(&config).expect("nodes should be listed");
+
+            assert_eq!(
+                nodes.keys().collect::<Vec<_>>(),
+                ["test_node1", "underlay_node1"],
+            );
+        }
+
         #[test]
         fn parses_empty_output() {
             let routes = parse_routes(b"", "BGP").expect("empty output should parse");
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH pve-network 2/3] api: fabrics: check node permissions with the node name in list_all
  2026-11-20 15:22 [PATCH network/proxmox-perl-rs 0/3] Fix listing fabric nodes of hosts in multiple fabrics Gabriel Goller
  2026-11-20 15:22 ` [PATCH proxmox-perl-rs 1/3] pve-rs: fabrics: list nodes of all fabrics Gabriel Goller
@ 2026-11-20 15:22 ` Gabriel Goller
  2026-11-20 15:22 ` [PATCH pve-network 3/3] api: fabrics: check node permissions with the node name in list_nodes Gabriel Goller
  2 siblings, 0 replies; 4+ messages in thread
From: Gabriel Goller @ 2026-11-20 15:22 UTC (permalink / raw)
  To: pve-devel

The node permission check used the hash key from pve-rs as node name.
For GET /cluster/sdn/fabrics/all, this key is the section ID
(<fabric>_<node>), so a user with Sys.Audit only on /nodes/<node> never
saw any fabric node.

New nodes in a pending config only have node_id below 'pending'.

Fixes: 21d2ad3f7b6d ("api: fabrics: add root-level module")
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 src/PVE/API2/Network/SDN/Fabrics.pm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/PVE/API2/Network/SDN/Fabrics.pm b/src/PVE/API2/Network/SDN/Fabrics.pm
index 5644fbee0fff..a669125894a1 100644
--- a/src/PVE/API2/Network/SDN/Fabrics.pm
+++ b/src/PVE/API2/Network/SDN/Fabrics.pm
@@ -156,9 +156,10 @@ __PACKAGE__->register_method({
         }
 
         my @res_nodes;
-        for my $node_id (keys %$nodes) {
-            my $node = $nodes->{$node_id};
+        for my $id (keys %$nodes) {
+            my $node = $nodes->{$id};
             my $fabric_id = $node->{fabric_id} // $node->{pending}->{fabric_id};
+            my $node_id = $node->{node_id} // $node->{pending}->{node_id};
 
             next if !$rpcenv->check_any($authuser, "/sdn/fabrics/$fabric_id", $fabric_privs, 1);
             next if !$rpcenv->check_any($authuser, "/nodes/$node_id", $node_privs, 1);
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH pve-network 3/3] api: fabrics: check node permissions with the node name in list_nodes
  2026-11-20 15:22 [PATCH network/proxmox-perl-rs 0/3] Fix listing fabric nodes of hosts in multiple fabrics Gabriel Goller
  2026-11-20 15:22 ` [PATCH proxmox-perl-rs 1/3] pve-rs: fabrics: list nodes of all fabrics Gabriel Goller
  2026-11-20 15:22 ` [PATCH pve-network 2/3] api: fabrics: check node permissions with the node name in list_all Gabriel Goller
@ 2026-11-20 15:22 ` Gabriel Goller
  2 siblings, 0 replies; 4+ messages in thread
From: Gabriel Goller @ 2026-11-20 15:22 UTC (permalink / raw)
  To: pve-devel

With the proxmox-perl-rs commit "pve-rs: fabrics: list nodes of all
fabrics", list_nodes() keys the nodes by section ID (<fabric>_<node>)
instead of the node name. Like for GET /cluster/sdn/fabrics/all, the
key can then no longer be used for the node permission check.

New nodes in a pending config only have node_id and fabric_id below
'pending'.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 src/PVE/API2/Network/SDN/Fabrics/Node.pm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/PVE/API2/Network/SDN/Fabrics/Node.pm b/src/PVE/API2/Network/SDN/Fabrics/Node.pm
index 851c8b1230fc..1141c6030b9e 100644
--- a/src/PVE/API2/Network/SDN/Fabrics/Node.pm
+++ b/src/PVE/API2/Network/SDN/Fabrics/Node.pm
@@ -93,9 +93,10 @@ __PACKAGE__->register_method({
 
         my @res;
 
-        for my $node_id (keys %$nodes) {
-            my $node = $nodes->{$node_id};
-            my $fabric_id = $node->{fabric_id};
+        for my $id (keys %$nodes) {
+            my $node = $nodes->{$id};
+            my $fabric_id = $node->{fabric_id} // $node->{pending}->{fabric_id};
+            my $node_id = $node->{node_id} // $node->{pending}->{node_id};
 
             next if !$rpcenv->check_any($authuser, "/sdn/fabrics/$fabric_id", $fabric_privs, 1);
             next if !$rpcenv->check_any($authuser, "/nodes/$node_id", $node_privs, 1);
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-20 15:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 15:22 [PATCH network/proxmox-perl-rs 0/3] Fix listing fabric nodes of hosts in multiple fabrics Gabriel Goller
2026-11-20 15:22 ` [PATCH proxmox-perl-rs 1/3] pve-rs: fabrics: list nodes of all fabrics Gabriel Goller
2026-11-20 15:22 ` [PATCH pve-network 2/3] api: fabrics: check node permissions with the node name in list_all Gabriel Goller
2026-11-20 15:22 ` [PATCH pve-network 3/3] api: fabrics: check node permissions with the node name in list_nodes 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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal