]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Fixed pipe reload/refeed to properly propagate as route refresh to the other table
authorMaria Matejka <mq@ucw.cz>
Wed, 5 Oct 2022 13:17:38 +0000 (15:17 +0200)
committerMaria Matejka <mq@ucw.cz>
Wed, 5 Oct 2022 13:17:38 +0000 (15:17 +0200)
proto/pipe/pipe.c
proto/pipe/pipe.h

index b3b50a0d92c571217fa6216988762ea5f8dc9622..0b0d9151e54d707c5ad7a1c441f0666131cdc338 100644 (file)
@@ -52,10 +52,18 @@ pipe_rt_notify(struct proto *P, struct channel *src_ch, const net_addr *n, rte *
 {
   struct pipe_proto *p = (void *) P;
   struct channel *dst = (src_ch == p->pri) ? p->sec : p->pri;
+  uint *flags = (src_ch == p->pri) ? &p->sec_flags : &p->pri_flags;
 
   if (!new && !old)
     return;
 
+  /* Start the route refresh if requested to */
+  if (*flags & PIPE_FL_RR_BEGIN_PENDING)
+  {
+    *flags &= ~PIPE_FL_RR_BEGIN_PENDING;
+    rt_refresh_begin(&dst->in_req);
+  }
+
   if (new)
     {
       rte e0 = {
@@ -104,6 +112,32 @@ pipe_reload_routes(struct channel *C)
   channel_request_feeding((C == p->pri) ? p->sec : p->pri);
 }
 
+static void
+pipe_feed_begin(struct channel *C, int initial UNUSED)
+{
+  struct pipe_proto *p = (void *) C->proto;
+  uint *flags = (C == p->pri) ? &p->sec_flags : &p->pri_flags;
+
+  *flags |= PIPE_FL_RR_BEGIN_PENDING;
+}
+
+static void
+pipe_feed_end(struct channel *C)
+{
+  struct pipe_proto *p = (void *) C->proto;
+  struct channel *dst = (C == p->pri) ? p->sec : p->pri;
+  uint *flags = (C == p->pri) ? &p->sec_flags : &p->pri_flags;
+
+  /* If not even started, start the RR now */
+  if (*flags & PIPE_FL_RR_BEGIN_PENDING)
+  {
+    *flags &= ~PIPE_FL_RR_BEGIN_PENDING;
+    rt_refresh_begin(&dst->in_req);
+  }
+
+  /* Finish RR always */
+  rt_refresh_end(&dst->in_req);
+}
 
 static void
 pipe_postconfig(struct proto_config *CF)
@@ -182,6 +216,8 @@ pipe_init(struct proto_config *CF)
   P->rt_notify = pipe_rt_notify;
   P->preexport = pipe_preexport;
   P->reload_routes = pipe_reload_routes;
+  P->feed_begin = pipe_feed_begin;
+  P->feed_end = pipe_feed_end;
 
   p->rl_gen = (struct tbf) TBF_DEFAULT_LOG_LIMITS;
 
index a6534e1cb531e5bec4205613df09d936d7723490..501b85654e0591bc98715214d32d6140d760cc8f 100644 (file)
@@ -20,7 +20,11 @@ struct pipe_proto {
   struct proto p;
   struct channel *pri;
   struct channel *sec;
+  uint pri_flags;
+  uint sec_flags;
   struct tbf rl_gen;
 };
 
+#define PIPE_FL_RR_BEGIN_PENDING       1       /* Route refresh should start with the first route notified */
+
 #endif