diff --git a/lib/srv6.c b/lib/srv6.c index ceb769ef76..ccb94b2f76 100644 --- a/lib/srv6.c +++ b/lib/srv6.c @@ -129,6 +129,8 @@ struct srv6_locator *srv6_locator_alloc(const char *name) locator = XCALLOC(MTYPE_SRV6_LOCATOR, sizeof(struct srv6_locator)); strlcpy(locator->name, name, sizeof(locator->name)); locator->chunks = list_new(); + locator->chunks->del = (void (*)(void *))srv6_locator_chunk_free; + QOBJ_REG(locator, srv6_locator); return locator; } @@ -144,7 +146,12 @@ struct srv6_locator_chunk *srv6_locator_chunk_alloc(void) void srv6_locator_free(struct srv6_locator *locator) { - XFREE(MTYPE_SRV6_LOCATOR, locator); + if (locator) { + QOBJ_UNREG(locator); + list_delete(&locator->chunks); + + XFREE(MTYPE_SRV6_LOCATOR, locator); + } } void srv6_locator_chunk_free(struct srv6_locator_chunk *chunk) diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 06aaa706dc..d5969ab9bb 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -2848,7 +2848,7 @@ stream_failure: static void zread_table_manager_request(ZAPI_HANDLER_ARGS) { - /* to avoid sending other messages like ZERBA_INTERFACE_UP */ + /* to avoid sending other messages like ZEBRA_INTERFACE_UP */ if (hdr->command == ZEBRA_TABLE_MANAGER_CONNECT) zread_table_manager_connect(client, msg, zvrf_id(zvrf)); else { @@ -2856,7 +2856,7 @@ static void zread_table_manager_request(ZAPI_HANDLER_ARGS) if (!client->proto) { flog_err( EC_ZEBRA_TM_ALIENS, - "Got table request from an unidentified client"); + "Got SRv6 request from an unidentified client"); return; } if (hdr->command == ZEBRA_GET_TABLE_CHUNK) diff --git a/zebra/zebra_srv6.c b/zebra/zebra_srv6.c index 5664a29682..b11331a180 100644 --- a/zebra/zebra_srv6.c +++ b/zebra/zebra_srv6.c @@ -181,13 +181,13 @@ assign_srv6_locator_chunk(uint8_t proto, loc->status_up = false; chunk = srv6_locator_chunk_alloc(); - chunk->proto = 0; + chunk->proto = NO_PROTO; listnode_add(loc->chunks, chunk); zebra_srv6_locator_add(loc); } for (ALL_LIST_ELEMENTS_RO((struct list *)loc->chunks, node, chunk)) { - if (chunk->proto != 0 && chunk->proto != proto) + if (chunk->proto != NO_PROTO && chunk->proto != proto) continue; chunk_found = true; break; @@ -199,6 +199,8 @@ assign_srv6_locator_chunk(uint8_t proto, } chunk->proto = proto; + chunk->instance = instance; + chunk->session_id = session_id; return loc; }