]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Pipe: Propagate debug flags from protocol to channels
authorOndrej Zajicek (work) <santiago@crfreenet.org>
Tue, 16 Mar 2021 19:10:00 +0000 (20:10 +0100)
committerOndrej Zajicek (work) <santiago@crfreenet.org>
Tue, 16 Mar 2021 19:10:00 +0000 (20:10 +0100)
Pipe channels are kind-of implicit, so setting protocol debug flags
should also set pipe debug flags.

nest/proto.c
proto/pipe/pipe.c

index b3c6fa4764cda6b44da4872055fb60d6a70ecd4d..f05fbe9265394c829366e37faa5365484c46efee 100644 (file)
@@ -2210,10 +2210,17 @@ proto_cmd_reload(struct proto *p, uintptr_t dir, int cnt UNUSED)
   cli_msg(-15, "%s: reloading", p->name);
 }
 
+extern void pipe_update_debug(struct proto *P);
+
 void
 proto_cmd_debug(struct proto *p, uintptr_t mask, int cnt UNUSED)
 {
   p->debug = mask;
+
+#ifdef CONFIG_PIPE
+  if (p->proto == &proto_pipe)
+    pipe_update_debug(p);
+#endif
 }
 
 void
index 7b5de32426df3536c97d9ff70671e4578b788aa1..3532f114f836b22b2c628402df7dbcaab7f07234 100644 (file)
@@ -141,6 +141,8 @@ pipe_postconfig(struct proto_config *CF)
 
   if (cc->in_keep_filtered)
     cf_error("Pipe protocol prohibits keeping filtered routes");
+
+  cc->debug = cf->c.debug;
 }
 
 static int
@@ -155,6 +157,7 @@ pipe_configure_channels(struct pipe_proto *p, struct pipe_config *cf)
     .out_filter = cc->out_filter,
     .in_limit = cc->in_limit,
     .ra_mode = RA_ANY,
+    .debug = cc->debug,
     .rpki_reload = cc->rpki_reload,
   };
 
@@ -165,6 +168,7 @@ pipe_configure_channels(struct pipe_proto *p, struct pipe_config *cf)
     .out_filter = cc->in_filter,
     .in_limit = cc->out_limit,
     .ra_mode = RA_ANY,
+    .debug = cc->debug,
     .rpki_reload = cc->rpki_reload,
   };
 
@@ -278,6 +282,14 @@ pipe_show_proto_info(struct proto *P)
     pipe_show_stats(p);
 }
 
+void
+pipe_update_debug(struct proto *P)
+{
+  struct pipe_proto *p = (void *) P;
+
+  p->pri->debug = p->sec->debug = p->p.debug;
+}
+
 
 struct protocol proto_pipe = {
   .name =              "Pipe",