summaryrefslogtreecommitdiff
path: root/lib/zclient.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-09-21 14:03:05 -0400
committerGitHub <noreply@github.com>2018-09-21 14:03:05 -0400
commit954182777368e31570d4a62c0c0837f3555e3615 (patch)
tree3bd0a47a83a688a06222dbe3f254886e06d071df /lib/zclient.c
parent11e27675823411a2519abb2095449da996b822e5 (diff)
parent20ae4acdbae26a28ded9a4030c9e219aa2b4f5e3 (diff)
Merge pull request #3016 from pacovn/label_manager_fixes
Label manager fixes
Diffstat (limited to 'lib/zclient.c')
-rw-r--r--lib/zclient.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/zclient.c b/lib/zclient.c
index 1cdf4ff22e..e6626a178b 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -1839,24 +1839,29 @@ static int zclient_read_sync_response(struct zclient *zclient,
* immediately reads the answer from the input buffer.
*
* @param zclient Zclient used to connect to label manager (zebra)
+ * @param async Synchronous (0) or asynchronous (1) operation
* @result Result of response
*/
-int lm_label_manager_connect(struct zclient *zclient)
+int lm_label_manager_connect(struct zclient *zclient, int async)
{
int ret;
struct stream *s;
uint8_t result;
+ uint16_t cmd = async ? ZEBRA_LABEL_MANAGER_CONNECT_ASYNC :
+ ZEBRA_LABEL_MANAGER_CONNECT;
if (zclient_debug)
zlog_debug("Connecting to Label Manager (LM)");
- if (zclient->sock < 0)
+ if (zclient->sock < 0) {
+ zlog_debug("%s: invalid zclient socket", __func__);
return -1;
+ }
/* send request */
s = zclient->obuf;
stream_reset(s);
- zclient_create_header(s, ZEBRA_LABEL_MANAGER_CONNECT, VRF_DEFAULT);
+ zclient_create_header(s, cmd, VRF_DEFAULT);
/* proto */
stream_putc(s, zclient->redist_default);
@@ -1882,8 +1887,11 @@ int lm_label_manager_connect(struct zclient *zclient)
if (zclient_debug)
zlog_debug("LM connect request sent (%d bytes)", ret);
+ if (async)
+ return 0;
+
/* read response */
- if (zclient_read_sync_response(zclient, ZEBRA_LABEL_MANAGER_CONNECT)
+ if (zclient_read_sync_response(zclient, cmd)
!= 0)
return -1;