summaryrefslogtreecommitdiffstats
path: root/lib/zclient.c
diff options
context:
space:
mode:
authorEmanuele Di Pascale <emanuele@voltanet.io>2019-06-12 16:33:12 +0200
committerEmanuele Di Pascale <emanuele@voltanet.io>2019-07-10 15:20:27 +0200
commit0e3b6a926a98a028fa9ed8a8a1d00b429f547c03 (patch)
tree4a58e7bb2e5fe257dd998d7198b1f974c200edd7 /lib/zclient.c
parentMerge pull request #4654 from manuhalo/fix_bgp_lbp_warn (diff)
downloadfrr-0e3b6a926a98a028fa9ed8a8a1d00b429f547c03.tar.xz
frr-0e3b6a926a98a028fa9ed8a8a1d00b429f547c03.zip
lib, zebra: support label chunk requests for SRGB
For SRGB, we need to support chunk requests starting at a specific point in the label space, rather than just asking for any sufficiently large chunk. To this purpose, we extend the label manager api to request a chunk with a base value; if the base is set to 0, the label manager will behave as it currently does, i.e. fetching the first free chunk big enough to satisfy the request. update all the existing calls to get chunks from the label manager so that they use MPLS_LABEL_BASE_ANY as the base for the requested chunk Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
Diffstat (limited to 'lib/zclient.c')
-rw-r--r--lib/zclient.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/zclient.c b/lib/zclient.c
index e9b4f5a58..c02ae5d0e 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -1995,10 +1995,11 @@ int lm_label_manager_connect(struct zclient *zclient, int async)
* @param zclient Zclient used to connect to label manager (zebra)
* @param keep Avoid garbage collection
* @param chunk_size Amount of labels requested
+ * @param base Base for the label chunk. if MPLS_LABEL_BASE_ANY we do not care
* @result 0 on success, -1 otherwise
*/
int zclient_send_get_label_chunk(struct zclient *zclient, uint8_t keep,
- uint32_t chunk_size)
+ uint32_t chunk_size, uint32_t base)
{
struct stream *s;
@@ -2018,6 +2019,7 @@ int zclient_send_get_label_chunk(struct zclient *zclient, uint8_t keep,
stream_putw(s, zclient->instance);
stream_putc(s, keep);
stream_putl(s, chunk_size);
+ stream_putl(s, base);
/* Put length at the first point of the stream. */
stream_putw_at(s, 0, stream_get_endp(s));
@@ -2038,7 +2040,7 @@ int zclient_send_get_label_chunk(struct zclient *zclient, uint8_t keep,
* @param end To write last assigned chunk label to
* @result 0 on success, -1 otherwise
*/
-int lm_get_label_chunk(struct zclient *zclient, uint8_t keep,
+int lm_get_label_chunk(struct zclient *zclient, uint8_t keep, uint32_t base,
uint32_t chunk_size, uint32_t *start, uint32_t *end)
{
int ret;
@@ -2063,6 +2065,8 @@ int lm_get_label_chunk(struct zclient *zclient, uint8_t keep,
stream_putc(s, keep);
/* chunk size */
stream_putl(s, chunk_size);
+ /* requested chunk base */
+ stream_putl(s, base);
/* Put length at the first point of the stream. */
stream_putw_at(s, 0, stream_get_endp(s));