diff options
author | Emanuele Di Pascale <emanuele@voltanet.io> | 2019-06-18 15:47:02 +0200 |
---|---|---|
committer | Emanuele Di Pascale <emanuele@voltanet.io> | 2019-06-24 11:35:44 +0200 |
commit | 614a0f861301788f0743ef6ad1c720b8e59d53ba (patch) | |
tree | 872294c617f2b72b0eeeaba3eddfe2b663dadf6e /zebra/label_manager.c | |
parent | bgpd: fix LU label callback crash (diff) | |
download | frr-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.c | 13 |
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; } |