]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
rt-show.c: fixed OBSREF_SET after cf_error(), changed message when 'show route export...
authorKaterina Kubecova <katerina.kubecova@nic.cz>
Tue, 19 Nov 2024 09:33:49 +0000 (10:33 +0100)
committerMaria Matejka <mq@ucw.cz>
Mon, 25 Nov 2024 16:06:24 +0000 (17:06 +0100)
nest/config.Y
nest/rt-show.c

index 37a7ad97a4af29d5a99a1fb14bccbf1dacecb51f..667a7e2c7d010864a1c369f00cc458f1545a7782 100644 (file)
@@ -735,7 +735,6 @@ r_args:
      $$ = cfg_allocz(sizeof(struct rt_show_data));
      init_list(&($$->tables));
      $$->filter = FILTER_ACCEPT;
-     OBSREF_SET($$->running_on_config, this_cli->main_config);
      $$->cli = this_cli;
      $$->tf_route = this_cli->main_config->tf_route;
    }
index 2bed1afcb80e57efc9e280a99d20c3793c9f58ed..84d6dcb0ab36708c9c6fc7256a668916135e7ca1 100644 (file)
@@ -361,14 +361,22 @@ rt_show_get_default_tables(struct rt_show_data *d)
 
   if (d->export_protocol)
   {
+    int seen_only_export_down = 1;
+    int tab_found = 0;
     WALK_LIST(c, d->export_protocol->channels)
     {
+      tab_found = 1;
       if (rt_export_get_state(&c->out_req) == TES_DOWN)
-       continue;
+        continue;
 
+      seen_only_export_down = 0;
       tab = rt_show_add_table(d, c->table);
       tab->export_channel = c;
     }
+
+    if (tab_found && seen_only_export_down)
+      cf_error("Requested 'show route export' to protocols which aren't accepting exports at all.");
+
     return;
   }
 
@@ -460,6 +468,11 @@ rt_show(struct rt_show_data *d)
 
   d->tab = HEAD(d->tables);
 
+  /* OBSREF_SET should not be called sooner than the last cf_error() may occur.
+     If cf_error() called after OBSREF_SET, the crreated obstacle may not be removed at all.
+     (cf_error() contains long jump.) */
+  OBSREF_SET(d->running_on_config, this_cli->main_config);
+
   this_cli->cleanup = rt_show_cleanup;
   this_cli->rover = d;
   this_cli->cont = rt_show_cont;