mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 02:37:21 +00:00
lib/zclient: Consolidate error reporting for zclient_read_header
All functions that call zclient_read_header immediately turn around and check to ensure that the version and marker fields are correct Move this code into zclient_read_header Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> (cherry picked from commit a9d4cb33faa6af622240190a80f41c4672374925)
This commit is contained in:
parent
bb882a8651
commit
195dd232eb
@ -347,6 +347,13 @@ zclient_read_header (struct stream *s, int sock, u_int16_t *size, u_char *marker
|
||||
*vrf_id = stream_getw (s);
|
||||
*cmd = stream_getw (s);
|
||||
|
||||
if (*version != ZSERV_VERSION || *marker != ZEBRA_HEADER_MARKER)
|
||||
{
|
||||
zlog_err("%s: socket %d version mismatch, marker %d, version %d",
|
||||
__func__, sock, *marker, *version);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (*size && stream_read (s, sock, *size) != *size)
|
||||
return -1;
|
||||
|
||||
|
@ -189,13 +189,6 @@ static int zclient_read_nexthop(struct zclient *zlookup,
|
||||
zclient_lookup_failed(zlookup);
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (version != ZSERV_VERSION || marker != ZEBRA_HEADER_MARKER) {
|
||||
zlog_err("%s: socket %d version mismatch, marker %d, version %d",
|
||||
__func__, zlookup->sock, marker, version);
|
||||
zclient_lookup_failed(zlookup);
|
||||
return -4;
|
||||
}
|
||||
}
|
||||
|
||||
raddr.s_addr = stream_get_ipv4(s);
|
||||
|
Loading…
Reference in New Issue
Block a user