]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/zclient.c
lib, zebra: support label chunk requests for SRGB
[mirror_frr.git] / lib / zclient.c
index 0972590ca695e9dfd70a1102e22dca1301c8b7c7..c02ae5d0e4a1dffc1d69c4ebcb41afcd25ce945f 100644 (file)
@@ -62,10 +62,13 @@ struct zclient *zclient_new(struct thread_master *master,
                            struct zclient_options *opt)
 {
        struct zclient *zclient;
+       size_t stream_size =
+               MAX(ZEBRA_MAX_PACKET_SIZ, sizeof(struct zapi_route));
+
        zclient = XCALLOC(MTYPE_ZCLIENT, sizeof(struct zclient));
 
-       zclient->ibuf = stream_new(ZEBRA_MAX_PACKET_SIZ);
-       zclient->obuf = stream_new(ZEBRA_MAX_PACKET_SIZ);
+       zclient->ibuf = stream_new(stream_size);
+       zclient->obuf = stream_new(stream_size);
        zclient->wb = buffer_new(0);
        zclient->master = master;
 
@@ -1992,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;
 
@@ -2015,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));
@@ -2035,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;
@@ -2060,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));