]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Nest: Pub/sub queue for VLAN requests
authorOndrej Zajicek <santiago@crfreenet.org>
Tue, 16 Sep 2025 14:08:36 +0000 (16:08 +0200)
committerMaria Matejka <mq@ucw.cz>
Wed, 13 May 2026 11:27:16 +0000 (13:27 +0200)
Publishers (EVPN protos) can send requests for VLANs, subscribers
(Bridge protos) will process them.

nest/iface.c
nest/iface.h

index 8f6caafbba18fac2a83bad62e21b3e415cf3178c..cd286ee72991c93e1bf26683d447fbe0dbd8398c 100644 (file)
@@ -38,6 +38,8 @@ static pool *if_pool;
 
 list iface_list;
 
+ps_queue vlan_requests;
+
 static void if_recalc_preferred(struct iface *i);
 
 /**
@@ -720,6 +722,8 @@ if_init(void)
   if_pool = rp_new(&root_pool, "Interfaces");
   init_list(&iface_list);
   neigh_init(if_pool);
+
+  ps_init_queue(&vlan_requests, &root_pool, "VLAN bus");
 }
 
 /*
index f17eaec2e390b7928d1555c1d36f4cd3b1da9c97..7e91a58fd2df5f35583bf6a273dc662b7025dd9a 100644 (file)
@@ -10,6 +10,7 @@
 #define _BIRD_IFACE_H_
 
 #include "lib/lists.h"
+#include "lib/pubsub.h"
 #include "lib/ip.h"
 
 extern list iface_list;
@@ -192,4 +193,27 @@ int iface_patts_equal(list *, list *, int (*)(struct iface_patt *, struct iface_
 
 u32 if_choose_router_id(struct iface_patt *mask, u32 old_id);
 
+
+/*
+ *     VLAN request queue
+ */
+
+struct vlan_req_data {
+  u32 vid;
+  u32 vni;
+};
+
+struct vlan_request {
+  struct iface *bridge;                        /* Bridge device, name -> topic */
+  struct iface *iface;                 /* Interface to add/remove VLANs */
+  uintptr_t owner;                     /* Owner of the VLAN, proto ptr */
+  bool update;                         /* Update / withdraw */
+  int vlan_count;                      /* Number of VLANs */
+  struct vlan_req_data vlans[];
+};
+
+#define VLAN_REQUEST_LENGTH(n) (sizeof(struct vlan_request) + (n) * sizeof(struct vlan_req_data))
+
+extern ps_queue vlan_requests;
+
 #endif