]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Client: explicit end of symbol dump
authorJan Moskyto Matejka <mq@ucw.cz>
Wed, 12 Jul 2017 10:43:32 +0000 (12:43 +0200)
committerJan Moskyto Matejka <mq@ucw.cz>
Wed, 12 Jul 2017 10:43:32 +0000 (12:43 +0200)
client/client.c
client/reply_codes.h
nest/cmds.c

index 741cae5b457667a16eaa0377dcf375c3ce9f1cd7..a09692301622fa22903f52289eafa3b657aa3e4a 100644 (file)
@@ -366,6 +366,7 @@ process_internal_message(int reply_code, const char *name)
       welcomed = 1;
       printf("BIRD %s ready.\n", name);
     }
+    symread = 1;
     return;
 
   case RC_NOTIFY:
@@ -382,15 +383,17 @@ process_internal_message(int reply_code, const char *name)
   case RC_TABLE_NAME:          flag = CLI_SF_TABLE; break;
   case RC_TEMPLATE_NAME:       flag = CLI_SF_TEMPLATE; break;
   case RC_INTERFACE_NAME:      flag = CLI_SF_INTERFACE; break;
+  case RC_DUMP_DONE:           symread = 0; return;
   default:
     printf("Undefined %d: %s", reply_code, name);
     return;
   }
 
-  if (flag && name && *name) {
-    symread = 1;
-    add_to_symbols(flag, name);
-  }
+  if (flag && name && *name)
+    if (symread)
+      add_to_symbols(flag, name);
+    else
+      printf("Unexpected symbol definition %d: %s", reply_code, name);
 }
 
 #define PRINTF(LEN, PARGS...) do { if (!skip_input && !complete) len = printf(PARGS); } while(0)
@@ -419,8 +422,7 @@ server_got_reply(char *x)
       else if (code)
       {
        PRINTF(len, "%s\n", verbose ? x : x+5);
-      } else if (symread)
-       symread = 0;
+      }
 
       if (x[4] == ' ')
       {
index 20b108b5d95397b705c17b326042107fddfc75a9..a9246d2d83c44beec9a4d569d75fa5f52452d9bb 100644 (file)
@@ -73,7 +73,7 @@ enum reply_code {
   RC_SHOW_RIP_INTERFACE = 1021,
   RC_SHOW_RIP_NEIGHBORS = 1022,
 
-  RC_BIRD_VERSION_NUM = 3000,
+  RC_BIRD_VERSION_NUM = 3000,   /* This begins the symbol dump */
   RC_TABLE_NAME = 3001,
   RC_PROTOCOL_NAME = 3002,
   RC_FILTER_NAME = 3003,
@@ -82,7 +82,8 @@ 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_DUMP_DONE = 3009,         /* This ends the symbol dump */
+  RC_NOTIFY = 3010,            /* Daemon notifies the client about new symbol set */
 
   RC_REPLY_TOO_LONG = 8000,
   RC_ROUTE_NOT_FOUND = 8001,
index 19b10cae4b333a039e37359f03bf854a48f4cc18..a36d838c812376a0c25badff23872e71294598f2 100644 (file)
@@ -113,7 +113,7 @@ cmd_send_symbols(void)
     if (!(i->flags & IF_SHUTDOWN))
       cli_msg(RC_INTERFACE_NAME, "\"%s\"", i->name);
 
-  cli_msg(0, "");
+  cli_msg(RC_DUMP_DONE, "");
 }
 
 static void