diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/log.c | 1 | ||||
| -rw-r--r-- | lib/monotime.h | 7 | ||||
| -rw-r--r-- | lib/mpls.h | 1 | ||||
| -rw-r--r-- | lib/zclient.c | 17 | ||||
| -rw-r--r-- | lib/zclient.h | 11 |
5 files changed, 27 insertions, 10 deletions
@@ -1122,6 +1122,7 @@ static const struct zebra_desc_table command_types[] = { DESC_ENTRY(ZEBRA_VXLAN_FLOOD_CONTROL), DESC_ENTRY(ZEBRA_VXLAN_SG_ADD), DESC_ENTRY(ZEBRA_VXLAN_SG_DEL), + DESC_ENTRY(ZEBRA_VXLAN_SG_REPLAY), }; #undef DESC_ENTRY diff --git a/lib/monotime.h b/lib/monotime.h index 6aac966ea1..ca27c45dc6 100644 --- a/lib/monotime.h +++ b/lib/monotime.h @@ -84,7 +84,10 @@ static inline int64_t monotime_until(const struct timeval *ref, return (int64_t)tv.tv_sec * 1000000LL + tv.tv_usec; } -static inline char *time_to_string(time_t ts) +/* Char buffer size for time-to-string api */ +#define MONOTIME_STRLEN 32 + +static inline char *time_to_string(time_t ts, char *buf) { struct timeval tv; time_t tbuf; @@ -92,7 +95,7 @@ static inline char *time_to_string(time_t ts) monotime(&tv); tbuf = time(NULL) - (tv.tv_sec - ts); - return ctime(&tbuf); + return ctime_r(&tbuf, buf); } #ifdef __cplusplus diff --git a/lib/mpls.h b/lib/mpls.h index b140c8e317..d7b56c47bd 100644 --- a/lib/mpls.h +++ b/lib/mpls.h @@ -54,6 +54,7 @@ extern "C" { #define MPLS_LABEL_RESERVED_MAX 15 #define MPLS_LABEL_UNRESERVED_MIN 16 #define MPLS_LABEL_UNRESERVED_MAX 1048575 +#define MPLS_LABEL_BASE_ANY 0 /* Default min and max SRGB label range */ /* Even if the SRGB allows to manage different Label space between routers, diff --git a/lib/zclient.c b/lib/zclient.c index e9b4f5a58b..6937700199 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)); @@ -2103,6 +2107,15 @@ int lm_get_label_chunk(struct zclient *zclient, uint8_t keep, "Wrong instId (%u) in get chunk response Should be %u", instance, zclient->instance); + /* if we requested a specific chunk and it could not be allocated, the + * response message will end here + */ + if (!STREAM_READABLE(s)) { + zlog_info("Unable to assign Label Chunk to %s instance %u", + zebra_route_string(proto), instance); + return -1; + } + /* keep */ response_keep = stream_getc(s); /* start and end labels */ diff --git a/lib/zclient.h b/lib/zclient.h index d651738687..81e454d192 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -176,6 +176,7 @@ typedef enum { ZEBRA_VXLAN_FLOOD_CONTROL, ZEBRA_VXLAN_SG_ADD, ZEBRA_VXLAN_SG_DEL, + ZEBRA_VXLAN_SG_REPLAY, } zebra_message_types_t; struct redist_proto { @@ -609,15 +610,13 @@ extern struct interface *zebra_interface_link_params_read(struct stream *s, vrf_id_t vrf_id); extern size_t zebra_interface_link_params_write(struct stream *, struct interface *); -extern int zclient_send_get_label_chunk( - struct zclient *zclient, - uint8_t keep, - uint32_t chunk_size); +extern int zclient_send_get_label_chunk(struct zclient *zclient, uint8_t keep, + uint32_t chunk_size, uint32_t base); extern int lm_label_manager_connect(struct zclient *zclient, int async); extern int lm_get_label_chunk(struct zclient *zclient, uint8_t keep, - uint32_t chunk_size, uint32_t *start, - uint32_t *end); + uint32_t base, uint32_t chunk_size, + uint32_t *start, uint32_t *end); extern int lm_release_label_chunk(struct zclient *zclient, uint32_t start, uint32_t end); extern int tm_table_manager_connect(struct zclient *zclient); |
