diff options
author | Emanuele Di Pascale <emanuele@voltanet.io> | 2019-06-27 10:59:22 +0200 |
---|---|---|
committer | Emanuele Di Pascale <emanuele@voltanet.io> | 2019-07-10 15:20:27 +0200 |
commit | f004f7c3cea1b0e68a6f150e52f387bf8509df5d (patch) | |
tree | 2528c14e79cb7a01b88449c557a147558e339daf /lib | |
parent | lib, zebra: support label chunk requests for SRGB (diff) | |
download | frr-f004f7c3cea1b0e68a6f150e52f387bf8509df5d.tar.xz frr-f004f7c3cea1b0e68a6f150e52f387bf8509df5d.zip |
lib, zebra: handle failure in get chunk
when requesting a specific label chunk (e.g. for the SRGB),
it might happen that we cannot get what we want. In this
event, we must be prepared to receive a response with no
label chunk. Without this fix, if the remote label manager
was not able to alloate the chunk we requested, we would
hang indefinitely trying to read data from the stream which
was not there.
Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/zclient.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/zclient.c b/lib/zclient.c index c02ae5d0e..693770019 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -2107,6 +2107,15 @@ int lm_get_label_chunk(struct zclient *zclient, uint8_t keep, uint32_t base, "Wrong instId (%u) in get chunk response Should be %u", instance, zclient->instance); + /* if we requested a specific chunk and it could not be allocated, the + * response message will end here + */ + if (!STREAM_READABLE(s)) { + zlog_info("Unable to assign Label Chunk to %s instance %u", + zebra_route_string(proto), instance); + return -1; + } + /* keep */ response_keep = stream_getc(s); /* start and end labels */ |