]> git.puffer.fish Git - matthieu/frr.git/commitdiff
pimd: Double read of stream
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 26 May 2016 16:41:55 +0000 (12:41 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 26 May 2016 23:21:20 +0000 (19:21 -0400)
The addition of the zclient_read_header call
reads the entirety of the stream for you and
makes sure it's consistent with the header.
When the function call was added it read the
stream data in zclient_read_header and then
reread the data after that.

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

index 9b572963a30d43a9bc6a39a63a08c00391e6f038..0ca3da20a040a5f658c5ad187942cba0ceaba9c3 100644 (file)
@@ -155,7 +155,6 @@ static int zclient_read_nexthop(struct zclient *zlookup,
   u_char version;
   uint16_t vrf_id;
   uint16_t command;
-  int nbytes;
   struct in_addr raddr;
   uint8_t distance;
   uint32_t metric;
@@ -189,14 +188,6 @@ static int zclient_read_nexthop(struct zclient *zlookup,
     return -2;
   }
   
-  nbytes = stream_read(s, zlookup->sock, length);
-  if (nbytes < length) {
-    zlog_err("%s %s: failure reading zclient lookup socket: nbytes=%d < len=%d",
-            __FILE__, __PRETTY_FUNCTION__, nbytes, length);
-    zclient_lookup_failed(zlookup);
-    return -3;
-  }
-  
   if (version != ZSERV_VERSION || marker != ZEBRA_HEADER_MARKER) {
     zlog_err("%s: socket %d version mismatch, marker %d, version %d",
             __func__, zlookup->sock, marker, version);