From: Donald Sharp Date: Thu, 26 May 2016 16:41:55 +0000 (-0400) Subject: pimd: Double read of stream X-Git-Tag: frr-2.0-rc1~670 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=762e563e522af9f5bfd843460c9940c1afae7061;p=matthieu%2Ffrr.git pimd: Double read of stream 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 --- diff --git a/pimd/pim_zlookup.c b/pimd/pim_zlookup.c index 9b572963a3..0ca3da20a0 100644 --- a/pimd/pim_zlookup.c +++ b/pimd/pim_zlookup.c @@ -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);