diff options
| author | paco <paco@voltanet.io> | 2018-06-07 15:28:12 +0200 |
|---|---|---|
| committer | paco <paco@voltanet.io> | 2018-06-07 15:28:59 +0200 |
| commit | e73380ce47d8838a6f4f0e9f7b6443e731bede96 (patch) | |
| tree | 19230a4980bdba5fbbdd8b3a17f402298ac97ae1 /lib/zclient.c | |
| parent | f89270226297ec1f1a8290481d1dc7fb66d71422 (diff) | |
bgpd, doc, ldpd, lib, tests, zebra: LM fixes
Corrections so that the BGP daemon can work with the label manager properly
through a label-manager proxy. Details:
- Correction so the BGP daemon behind a proxy label manager gets the range
correctly (-I added to the BGP daemon, to set the daemon instance id)
- For the BGP case, added an asynchronous label manager connect command so
the labels get recycled in case of a BGP daemon reconnection. With this,
BGPd and LDPd would behave similarly.
Signed-off-by: F. Aragon <paco@voltanet.io>
Diffstat (limited to 'lib/zclient.c')
| -rw-r--r-- | lib/zclient.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/zclient.c b/lib/zclient.c index 1b46ed671e..4c29b9ec24 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -2046,24 +2046,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); @@ -2089,8 +2094,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; |
