]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Notify all daemons about locator delete
authorCarmine Scarpitta <cscarpit@cisco.com>
Thu, 2 May 2024 21:50:38 +0000 (23:50 +0200)
committerCarmine Scarpitta <cscarpit@cisco.com>
Thu, 13 Jun 2024 12:54:16 +0000 (14:54 +0200)
Currently, when a locator is deleted in zebra, zebra notifies only the
zclient that owns the locator.

With the introduction of SID Manager, the locator is no longer owned by
any client. Instead, the locator is owned by Zebra, and clients can
allocate and release SIDs from the locator using the ZAPI
ZEBRA_SRV6_MANAGER_GET_SID and ZEBRA_SRV6_MANAGER_RELEASE_SID.

Therefore, when a locator is removed in Zebra, we need to notify all
daemons so that they can release/uninstall the SIDs allocated by that
locator.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
zebra/zebra_srv6.c

index 663afa2f855d203af54aec1357a4473131b8e557..aac4ba86a9b46dc64b068a02ddaf25e138ee2095 100644 (file)
@@ -634,7 +634,6 @@ void zebra_srv6_locator_add(struct srv6_locator *locator)
 void zebra_srv6_locator_delete(struct srv6_locator *locator)
 {
        struct listnode *n;
-       struct srv6_locator_chunk *c;
        struct zebra_srv6 *srv6 = zebra_srv6_get_default();
        struct zserv *client;
 
@@ -649,18 +648,8 @@ void zebra_srv6_locator_delete(struct srv6_locator *locator)
         * by ZEBRA_SRV6_LOCATOR_DELETE, and this notification is sent to the
         * owner of each chunk.
         */
-       for (ALL_LIST_ELEMENTS_RO((struct list *)locator->chunks, n, c)) {
-               if (c->proto == ZEBRA_ROUTE_SYSTEM)
-                       continue;
-               client = zserv_find_client(c->proto, c->instance);
-               if (!client) {
-                       zlog_warn(
-                               "%s: Not found zclient(proto=%u, instance=%u).",
-                               __func__, c->proto, c->instance);
-                       continue;
-               }
+       for (ALL_LIST_ELEMENTS_RO(zrouter.client_list, n, client))
                zsend_zebra_srv6_locator_delete(client, locator);
-       }
 
        listnode_delete(srv6->locators, locator);
        srv6_locator_free(locator);
@@ -703,7 +692,6 @@ void zebra_notify_srv6_locator_add(struct srv6_locator *locator)
 void zebra_notify_srv6_locator_delete(struct srv6_locator *locator)
 {
        struct listnode *n;
-       struct srv6_locator_chunk *c;
        struct zserv *client;
 
        /*
@@ -717,17 +705,8 @@ void zebra_notify_srv6_locator_delete(struct srv6_locator *locator)
         * by ZEBRA_SRV6_LOCATOR_DELETE, and this notification is sent to the
         * owner of each chunk.
         */
-       for (ALL_LIST_ELEMENTS_RO((struct list *)locator->chunks, n, c)) {
-               if (c->proto == ZEBRA_ROUTE_SYSTEM)
-                       continue;
-               client = zserv_find_client(c->proto, c->instance);
-               if (!client) {
-                       zlog_warn("Not found zclient(proto=%u, instance=%u).",
-                                 c->proto, c->instance);
-                       continue;
-               }
+       for (ALL_LIST_ELEMENTS_RO(zrouter.client_list, n, client))
                zsend_zebra_srv6_locator_delete(client, locator);
-       }
 }
 
 struct zebra_srv6 srv6;