From: Quentin Young Date: Fri, 9 Mar 2018 20:59:39 +0000 (-0500) Subject: lib, zebra: clean up zapi nits X-Git-Tag: frr-5.0-dev~169^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=107afcd10b59be3441e2b1f358942ca5e760daa2;p=matthieu%2Ffrr.git lib, zebra: clean up zapi nits * Get correct data size when parsing VRF ids * Move some vars into smaller scope Signed-off-by: Quentin Young --- diff --git a/lib/zclient.c b/lib/zclient.c index 20aaaca161..c720e2519b 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -327,7 +327,7 @@ bool zapi_parse_header(struct stream *zmsg, struct zmsghdr *hdr) STREAM_GETW(zmsg, hdr->length); STREAM_GETC(zmsg, hdr->marker); STREAM_GETC(zmsg, hdr->version); - STREAM_GETC(zmsg, hdr->vrf_id); + STREAM_GETL(zmsg, hdr->vrf_id); STREAM_GETW(zmsg, hdr->command); return true; stream_failure: diff --git a/zebra/zserv.c b/zebra/zserv.c index ac2fe9c0e2..4cdb97be42 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -2850,11 +2850,6 @@ static int zserv_read(struct thread *thread) #else int packets = zebrad.packets_to_process; #endif - struct zmsghdr hdr; - ssize_t nb; - bool hdrvalid; - char errmsg[256]; - /* Get thread data. Reset reading thread because I'm running. */ sock = THREAD_FD(thread); client = THREAD_ARG(thread); @@ -2865,6 +2860,11 @@ static int zserv_read(struct thread *thread) } while (packets) { + struct zmsghdr hdr; + ssize_t nb; + bool hdrvalid; + char errmsg[256]; + already = stream_get_endp(client->ibuf_work); /* Read length and command (if we don't have it already). */