]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
fixup! fixup! partial reload for RPKI - not working
authorKaterina Kubecova <katerina.kubecova@nic.cz>
Tue, 24 Oct 2023 12:39:40 +0000 (14:39 +0200)
committerKaterina Kubecova <katerina.kubecova@nic.cz>
Tue, 24 Oct 2023 12:39:40 +0000 (14:39 +0200)
proto/bgp/bgp.c
proto/ospf/ospf.c
proto/ospf/ospf.h
proto/ospf/rt.c
proto/rip/rip.c
proto/rip/rip.h

index e9ca4038a1c9824cddca2e90d6048f3d864c1293..9bd117d30591c5622575f90ac28514bd27f832f3 100644 (file)
@@ -1565,7 +1565,6 @@ bgp_reload_routes(struct channel *C, struct channel_import_request *cir)
 {
   struct bgp_proto *p = (void *) C->proto;
   struct bgp_channel *c = (void *) C;
-  log("in bgp");
 
   /* Ignore non-BGP channels */
   if (C->class != &channel_bgp)
index 7ec7dcfb29036b0f8db30c5647de7935314aa4f4..3b1b8314e016437e7c0ef40cbbee09d9e44873de 100644 (file)
@@ -438,10 +438,15 @@ ospf_reload_routes(struct channel *C, struct channel_import_request *cir)
   struct ospf_proto *p = (struct ospf_proto *) C->proto;
 
   if (cir) {
-    pthread_mutex_lock(&p->mutex);
+    if (p->lock == NULL)
+      {
+        p->lock = DOMAIN_NEW(attrs);
+        DOMAIN_SETUP(attrs, p->lock, "Partial request lock ospf", NULL);
+      }
+    DG_LOCK(p->lock);
     cir->next = p->cir;
     p->cir = cir;
-    pthread_mutex_unlock(&p->mutex);
+    DG_UNLOCK(p->lock);
   }
   if (p->calcrt == 2)
     return 1;
index c37c090b0e2d30c428dde768c6279e4243a15fe7..4fffac122e7d44ca02230a7706843dab6a700f3a 100644 (file)
@@ -11,7 +11,6 @@
 #ifndef _BIRD_OSPF_H_
 #define _BIRD_OSPF_H_
 
-#include <pthread.h>
 #include "nest/bird.h"
 
 #include "lib/checksum.h"
@@ -221,7 +220,7 @@ struct ospf_proto
   int calcrt;                  /* Routing table calculation scheduled?
                                   0=no, 1=normal, 2=forced reload */
   struct channel_import_request *cir; /* Struct with trie for partial reload */
-  pthread_mutex_t mutex;       /* Mutex for partial reload */
+  DOMAIN(attrs) lock;  /*nebo struct domain_generic *? *//* Lock for partial reload */
   list iface_list;             /* List of OSPF interfaces (struct ospf_iface) */
   list area_list;              /* List of OSPF areas (struct ospf_area) */
   int areano;                  /* Number of area I belong to */
index df71f88d893a051935d391422ebfa54b68dd4d22..8eec6e97d225d4893e144076c676b4fff56cbc80 100644 (file)
@@ -2019,10 +2019,10 @@ rt_sync(struct ospf_proto *p)
 
   OSPF_TRACE(D_EVENTS, "Starting routing table synchronization");
 
-  pthread_mutex_lock(&p->mutex);
+  DG_LOCK(attr, p->lock);
   struct channel_import_request *cir = p->cir;
   p->cir = NULL;
-  pthread_mutex_unlock(&p->mutex);
+  DG_UNLOCK(attr, p->lock);
   
   DBG("Now syncing my rt table with nest's\n");
   FIB_ITERATE_INIT(&fit, fib);
index ffcf34285707a667b40a7bc0514f6a781384dacd..66f43f376dddcf6ceeebc0d1bc7c1151b9aeb317 100644 (file)
@@ -968,10 +968,10 @@ rip_timer(timer *t)
 
   FIB_ITERATE_INIT(&fit, &p->rtable);
   
-  pthread_mutex_lock(&p->mutex);
+  DG_LOCK(attrs, p->lock);
   struct channel_import_request *cir = p->cir;
   p->cir = NULL;
-  pthread_mutex_unlock(&p->mutex);
+  DG_UNLOCK(attrs, p->lock);
 
   loop:
   FIB_ITERATE_START(&p->rtable, &fit, struct rip_entry, en)
@@ -1163,10 +1163,15 @@ rip_reload_routes(struct channel *C, struct channel_import_request *cir)
   struct rip_proto *p = (struct rip_proto *) C->proto;
   
   if (cir) {
-    pthread_mutex_lock(&p->mutex);
+    if (p->lock==NULL)
+      {
+        p->lock = DOMAIN_NEW(attrs);
+        DOMAIN_SETUP(attrs, p->lock, "Partial request lock rip", NULL);
+      }
+    DG_LOCK(p->lock);
     cir->next = p->cir;
     p->cir = cir;
-    pthread_mutex_lock(&p->mutex);
+    DG_UNLOCK(p->lock);
   }
   if (p->rt_reload)
     return 1;
index 541365593de148fbd5fa99b2ba8cdda00e4f4cc5..cab5deb8b74420b7679e868eb7acb39468928e03 100644 (file)
@@ -12,7 +12,6 @@
 #ifndef _BIRD_RIP_H_
 #define _BIRD_RIP_H_
 
-#include <pthread.h>
 #include "nest/bird.h"
 #include "nest/cli.h"
 #include "nest/iface.h"
@@ -105,7 +104,7 @@ struct rip_proto
   struct tbf log_pkt_tbf;              /* TBF for packet messages */
   struct tbf log_rte_tbf;              /* TBF for RTE messages */
   struct channel_import_request *cir;  /* Trie for partial reload */
-  pthread_mutex_t mutex;               /* Mutex for partial reload */
+  DOMAIN(attrs) lock;          /* Lock for partial reload */
 };
 
 struct rip_iface