mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 16:04:49 +00:00
pimd: Allow command zclient to find it's data
pim has two zclient sockets to zebra. One is used exclusively to do mrib lookups. The other is to do the normal day to day communication between pim and zebra. With the change to the zebra api to send up all data to all sockets this caused the mrib lookup socket to accumulate data in between mrib lookups. So if at some point in time we get upcoming data but no mrib lookups modify the code to find the mrib lookup it is looking for. Long term we need to figure something else out but this change will get us moving forward again. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
This commit is contained in:
parent
ebe32f70f1
commit
78d3e25770
@ -154,7 +154,7 @@ static int zclient_read_nexthop(struct zclient *zlookup,
|
||||
u_char marker;
|
||||
u_char version;
|
||||
vrf_id_t vrf_id;
|
||||
uint16_t command;
|
||||
uint16_t command = 0;
|
||||
struct in_addr raddr;
|
||||
uint8_t distance;
|
||||
uint32_t metric;
|
||||
@ -170,36 +170,33 @@ static int zclient_read_nexthop(struct zclient *zlookup,
|
||||
}
|
||||
|
||||
s = zlookup->ibuf;
|
||||
stream_reset(s);
|
||||
|
||||
err = zclient_read_header (s, zlookup->sock, &length, &marker, &version,
|
||||
&vrf_id, &command);
|
||||
if (err < 0) {
|
||||
zlog_err("%s %s: zclient_read_header() failed",
|
||||
__FILE__, __PRETTY_FUNCTION__);
|
||||
zclient_lookup_failed(zlookup);
|
||||
return -1;
|
||||
}
|
||||
while (command != ZEBRA_IPV4_NEXTHOP_LOOKUP_MRIB)
|
||||
{
|
||||
stream_reset(s);
|
||||
err = zclient_read_header (s, zlookup->sock, &length, &marker, &version,
|
||||
&vrf_id, &command);
|
||||
if (err < 0) {
|
||||
zlog_err("%s %s: zclient_read_header() failed",
|
||||
__FILE__, __PRETTY_FUNCTION__);
|
||||
zclient_lookup_failed(zlookup);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (length < MIN_LEN) {
|
||||
zlog_err("%s %s: failure reading zclient lookup socket: len=%d < MIN_LEN=%d",
|
||||
__FILE__, __PRETTY_FUNCTION__, length, MIN_LEN);
|
||||
zclient_lookup_failed(zlookup);
|
||||
return -2;
|
||||
}
|
||||
if (length < MIN_LEN) {
|
||||
zlog_err("%s %s: failure reading zclient lookup socket: len=%d < MIN_LEN=%d",
|
||||
__FILE__, __PRETTY_FUNCTION__, length, MIN_LEN);
|
||||
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;
|
||||
}
|
||||
|
||||
if (command != ZEBRA_IPV4_NEXTHOP_LOOKUP_MRIB) {
|
||||
zlog_err("%s: socket %d command mismatch: %d",
|
||||
__func__, zlookup->sock, command);
|
||||
return -5;
|
||||
}
|
||||
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