]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
BIRD daemon notifies the client about new symbol set
authorPavel Tvrdik <pawel.tvrdik@gmail.com>
Mon, 25 Apr 2016 14:48:39 +0000 (16:48 +0200)
committerPavel Tvrdik <pawel.tvrdik@gmail.com>
Mon, 25 Apr 2016 14:48:39 +0000 (16:48 +0200)
BIRD pushes notification to the client about new symbol set and then
the client should request a package with all symbols (`refresh symbols`).

client/client.c
client/reply_codes.h
conf/conf.c
sysdep/unix/main.c

index 4f7cce1de22ccd684b16217bd5a62c9f2b243d6e..5d8f1b379bfb5a9107725f351148111143dcaf97 100644 (file)
@@ -318,12 +318,18 @@ cli_get_symbol_maxlen(void)
 }
 
 static void
-server_got_symbol(int reply_code, const char *name)
+process_internal_message(int reply_code, const char *name)
 {
   u32 flag = 0;
 
   switch (reply_code)
   {
+  case RC_NOTIFY:
+    if (interactive)
+      retrieve_symbols();
+    return;
+
+  /* Symbols */
   case RC_CONSTANT_NAME:       flag = CLI_SF_CONSTANT; break;
   case RC_VARIABLE_NAME:       flag = CLI_SF_VARIABLE; break;
   case RC_FILTER_NAME:         flag = CLI_SF_FILTER; break;
@@ -337,7 +343,8 @@ server_got_symbol(int reply_code, const char *name)
     return;
   }
 
-  add_to_symbols(flag, name);
+  if (flag && name && *name)
+    add_to_symbols(flag, name);
 }
 
 #define PRINTF(LEN, PARGS...) do { if (!skip_input) len = printf(PARGS); } while(0)
@@ -358,7 +365,7 @@ server_got_reply(char *x)
     {
       if (code >= 3000 && code < 4000)
       {
-       server_got_symbol(code, x+5);
+       process_internal_message(code, x+5);
       }
       else if (code)
       {
index 5fd399e831f7e505ffbb8a31e0dcc36d6c71a126..2b22270868f319858365b031613f46bf8fa66229 100644 (file)
@@ -81,6 +81,7 @@ enum reply_code {
   RC_VARIABLE_NAME = 3006,
   RC_TEMPLATE_NAME = 3007,
   RC_INTERFACE_NAME = 3008,
+  RC_NOTIFY = 3009,            /* Daemon notifies the client about new symbol set */
 
   RC_REPLY_TOO_LONG = 8000,
   RC_ROUTE_NOT_FOUND = 8001,
index 3fd10ad82b6331f976b2817074df6fe21ec04751..4975c2f3c81c97f12b12a068ba9f1d171dbeb2a6 100644 (file)
@@ -448,6 +448,7 @@ config_undo(void)
 }
 
 extern void cmd_reconfig_undo_notify(void);
+extern void cmd_reconfig_msg(int r);
 
 static void
 config_timeout(struct timer *t)
@@ -458,6 +459,8 @@ config_timeout(struct timer *t)
   int r = config_undo();
   if (r < 0)
     log(L_ERR "Undo request failed");
+
+  cmd_reconfig_msg(r);
 }
 
 void
index 8796ab9c380bae170405d06373dcbeb454f68a16..5504a77171e44c967d460b99c2be4b25f8f34eb6 100644 (file)
@@ -33,6 +33,7 @@
 #include "nest/locks.h"
 #include "conf/conf.h"
 #include "filter/filter.h"
+#include "client/reply_codes.h"
 
 #include "unix.h"
 #include "krt.h"
@@ -269,12 +270,12 @@ cmd_check_config(char *name)
   config_free(conf);
 }
 
-static void
+void
 cmd_reconfig_msg(int r)
 {
   switch (r)
     {
-    case CONF_DONE:    cli_msg( 3, "Reconfigured"); break;
+    case CONF_DONE:    cli_msg( 3, "Reconfigured"); cli_msg(RC_NOTIFY, ""); cli_msg(19, "Nothing to do"); break;
     case CONF_PROGRESS: cli_msg( 4, "Reconfiguration in progress"); break;
     case CONF_QUEUED:  cli_msg( 5, "Reconfiguration already in progress, queueing new config"); break;
     case CONF_UNQUEUED:        cli_msg(17, "Reconfiguration already in progress, removing queued config"); break;