Merge pull request #8807 from mjstapp/fix_srv6_delete

lib,zebra: srv6 cleanup
This commit is contained in:
Donald Sharp 2021-06-09 09:07:53 -04:00 committed by GitHub
commit 6dbaa012be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 5 deletions

View File

@ -129,6 +129,8 @@ struct srv6_locator *srv6_locator_alloc(const char *name)
locator = XCALLOC(MTYPE_SRV6_LOCATOR, sizeof(struct srv6_locator)); locator = XCALLOC(MTYPE_SRV6_LOCATOR, sizeof(struct srv6_locator));
strlcpy(locator->name, name, sizeof(locator->name)); strlcpy(locator->name, name, sizeof(locator->name));
locator->chunks = list_new(); locator->chunks = list_new();
locator->chunks->del = (void (*)(void *))srv6_locator_chunk_free;
QOBJ_REG(locator, srv6_locator); QOBJ_REG(locator, srv6_locator);
return locator; return locator;
} }
@ -144,7 +146,12 @@ struct srv6_locator_chunk *srv6_locator_chunk_alloc(void)
void srv6_locator_free(struct srv6_locator *locator) void srv6_locator_free(struct srv6_locator *locator)
{ {
if (locator) {
QOBJ_UNREG(locator);
list_delete(&locator->chunks);
XFREE(MTYPE_SRV6_LOCATOR, locator); XFREE(MTYPE_SRV6_LOCATOR, locator);
}
} }
void srv6_locator_chunk_free(struct srv6_locator_chunk *chunk) void srv6_locator_chunk_free(struct srv6_locator_chunk *chunk)

View File

@ -2848,7 +2848,7 @@ stream_failure:
static void zread_table_manager_request(ZAPI_HANDLER_ARGS) 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) if (hdr->command == ZEBRA_TABLE_MANAGER_CONNECT)
zread_table_manager_connect(client, msg, zvrf_id(zvrf)); zread_table_manager_connect(client, msg, zvrf_id(zvrf));
else { else {
@ -2856,7 +2856,7 @@ static void zread_table_manager_request(ZAPI_HANDLER_ARGS)
if (!client->proto) { if (!client->proto) {
flog_err( flog_err(
EC_ZEBRA_TM_ALIENS, EC_ZEBRA_TM_ALIENS,
"Got table request from an unidentified client"); "Got SRv6 request from an unidentified client");
return; return;
} }
if (hdr->command == ZEBRA_GET_TABLE_CHUNK) if (hdr->command == ZEBRA_GET_TABLE_CHUNK)

View File

@ -181,13 +181,13 @@ assign_srv6_locator_chunk(uint8_t proto,
loc->status_up = false; loc->status_up = false;
chunk = srv6_locator_chunk_alloc(); chunk = srv6_locator_chunk_alloc();
chunk->proto = 0; chunk->proto = NO_PROTO;
listnode_add(loc->chunks, chunk); listnode_add(loc->chunks, chunk);
zebra_srv6_locator_add(loc); zebra_srv6_locator_add(loc);
} }
for (ALL_LIST_ELEMENTS_RO((struct list *)loc->chunks, node, chunk)) { 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; continue;
chunk_found = true; chunk_found = true;
break; break;
@ -199,6 +199,8 @@ assign_srv6_locator_chunk(uint8_t proto,
} }
chunk->proto = proto; chunk->proto = proto;
chunk->instance = instance;
chunk->session_id = session_id;
return loc; return loc;
} }