]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Always read full zapi message in ptm code
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 11 Oct 2017 12:09:28 +0000 (08:09 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 23 Oct 2017 22:09:22 +0000 (18:09 -0400)
The ptm code when it encountered an error situation
was not fully reading all the data in the stream
meant for it.  Ensure that this is read.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra/zebra_ptm.c

index 93b0723d8b8f235de6805db9ef50b87fcbcc5f2c..12d7387ed71663de742704858c5443216408f342 100644 (file)
@@ -961,6 +961,9 @@ int zebra_ptm_bfd_client_register(struct zserv *client, int sock,
                zlog_debug("bfd_client_register msg from client %s: length=%d",
                           zebra_route_string(client->proto), length);
 
+       s = client->ibuf;
+       pid = stream_getl(s);
+
        if (ptm_cb.ptm_sock == -1) {
                ptm_cb.t_timer = NULL;
                thread_add_timer(zebrad.master, zebra_ptm_connect, NULL,
@@ -977,9 +980,6 @@ int zebra_ptm_bfd_client_register(struct zserv *client, int sock,
        ptm_lib_append_msg(ptm_hdl, out_ctxt, ZEBRA_PTM_BFD_CLIENT_FIELD,
                           tmp_buf);
 
-       s = client->ibuf;
-
-       pid = stream_getl(s);
        sprintf(tmp_buf, "%d", pid);
        ptm_lib_append_msg(ptm_hdl, out_ctxt, ZEBRA_PTM_BFD_SEQID_FIELD,
                           tmp_buf);