zebra: Add functions to alloc/release SRv6 SIDs

Add functions to allocate/release SRv6 SIDs. SIDs can be allocated
either explicitly (allocate a specific SID) or dynamically (allocate any
available SID).

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
This commit is contained in:
Carmine Scarpitta 2024-03-23 16:30:58 +01:00
parent f8da4a29e5
commit c570d2bcae
5 changed files with 1290 additions and 1 deletions

View file

@ -1149,7 +1149,7 @@ int zsend_zebra_srv6_locator_add(struct zserv *client, struct srv6_locator *loc)
locator.node_bits_length = format->node_len; locator.node_bits_length = format->node_len;
locator.function_bits_length = format->function_len; locator.function_bits_length = format->function_len;
locator.argument_bits_length = format->argument_len; locator.argument_bits_length = format->argument_len;
if (format->type == ZEBRA_SRV6_SID_FORMAT_TYPE_USID) if (format->type == SRV6_SID_FORMAT_TYPE_USID)
SET_FLAG(locator.flags, SRV6_LOCATOR_USID); SET_FLAG(locator.flags, SRV6_LOCATOR_USID);
} }

View file

@ -787,6 +787,18 @@ static struct log_ref ferr_zebra_err[] = {
.suggestion = .suggestion =
"Wait for Zebra to reattempt update.", "Wait for Zebra to reattempt update.",
}, },
{
.code = EC_ZEBRA_SM_CANNOT_ASSIGN_SID,
.title = "SRv6 manager unable to assign SID",
.description = "Zebra's SRv6 manager was unable to assign a SID to client.",
.suggestion = "Ensure that Zebra has a sufficient SID range available.",
},
{
.code = EC_ZEBRA_SM_DAEMON_MISMATCH,
.title = "Daemon mismatch when releasing SRV6 SIDs",
.description = "Zebra noticed a mismatch between a SRv6 SID and a protocol daemon number or instance when releasing unused SRv6 SIDs.",
.suggestion = "Ignore this error.",
},
{ {
.code = END_FERR, .code = END_FERR,
} }

View file

@ -124,6 +124,8 @@ enum zebra_log_refs {
EC_ZEBRA_GRE_SET_UPDATE, EC_ZEBRA_GRE_SET_UPDATE,
EC_ZEBRA_SRV6M_UNRELEASED_LOCATOR_CHUNK, EC_ZEBRA_SRV6M_UNRELEASED_LOCATOR_CHUNK,
EC_ZEBRA_INTF_UPDATE_FAILURE, EC_ZEBRA_INTF_UPDATE_FAILURE,
EC_ZEBRA_SM_CANNOT_ASSIGN_SID,
EC_ZEBRA_SM_DAEMON_MISMATCH,
}; };
void zebra_error_init(void); void zebra_error_init(void);

File diff suppressed because it is too large Load diff

View file

@ -294,6 +294,11 @@ extern void srv6_manager_get_locator_call(struct srv6_locator **locator,
struct zserv *client, struct zserv *client,
const char *locator_name); const char *locator_name);
extern int get_srv6_sid(struct zebra_srv6_sid **sid, struct srv6_sid_ctx *ctx,
struct in6_addr *sid_value, const char *locator_name);
extern int release_srv6_sid(struct zserv *client,
struct zebra_srv6_sid_ctx *zctx);
extern struct zebra_srv6_sid_ctx *zebra_srv6_sid_ctx_alloc(void); extern struct zebra_srv6_sid_ctx *zebra_srv6_sid_ctx_alloc(void);
extern void zebra_srv6_sid_ctx_free(struct zebra_srv6_sid_ctx *ctx); extern void zebra_srv6_sid_ctx_free(struct zebra_srv6_sid_ctx *ctx);
extern void delete_zebra_srv6_sid_ctx(void *val); extern void delete_zebra_srv6_sid_ctx(void *val);