summaryrefslogtreecommitdiffstats
path: root/zebra/label_manager.c
diff options
context:
space:
mode:
authorEmanuele Di Pascale <emanuele@voltanet.io>2019-06-18 15:47:02 +0200
committerEmanuele Di Pascale <emanuele@voltanet.io>2019-06-24 11:35:44 +0200
commit614a0f861301788f0743ef6ad1c720b8e59d53ba (patch)
tree872294c617f2b72b0eeeaba3eddfe2b663dadf6e /zebra/label_manager.c
parentbgpd: fix LU label callback crash (diff)
downloadfrr-614a0f861301788f0743ef6ad1c720b8e59d53ba.tar.xz
frr-614a0f861301788f0743ef6ad1c720b8e59d53ba.zip
zebra: fix label manager EAGAIN error
when receiving an EAGAIN while trying to read the header of a ZAPI message, we were erroneously continuing as if everything was fine, which could crash zebra. Fix this by returning and letting the re-armed read task deal with this Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
Diffstat (limited to 'zebra/label_manager.c')
-rw-r--r--zebra/label_manager.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/zebra/label_manager.c b/zebra/label_manager.c
index 16d45836e..8295e461c 100644
--- a/zebra/label_manager.c
+++ b/zebra/label_manager.c
@@ -75,6 +75,10 @@ static int relay_response_back(void)
unsigned short instance;
struct zserv *zserv;
+ /* sanity */
+ if (!zclient || zclient->sock < 0)
+ return -1;
+
/* input buffer with msg from label manager */
src = zclient->ibuf;
@@ -83,10 +87,11 @@ static int relay_response_back(void)
/* parse header */
ret = zclient_read_header(src, zclient->sock, &size, &marker, &version,
&vrf_id, &resp_cmd);
- if (ret < 0 && errno != EAGAIN) {
- flog_err(EC_ZEBRA_LM_RESPONSE,
- "Error reading Label Manager response: %s",
- strerror(errno));
+ if (ret < 0) {
+ if (errno != EAGAIN)
+ flog_err(EC_ZEBRA_LM_RESPONSE,
+ "Error reading Label Manager response: %s",
+ strerror(errno));
return -1;
}