zebra_dplane_pre_finish();
/* Clean up GR related info. */
- zebra_gr_stale_client_cleanup(zrouter.stale_client_list);
- list_delete_all_node(zrouter.stale_client_list);
+ zebra_gr_stale_client_cleanup();
/* Clean up zapi clients and server module */
frr_each_safe (zserv_client_list, &zrouter.client_list, client)
rib_update_finish();
- list_delete(&zrouter.stale_client_list);
-
/*
* Besides other clean-ups zebra's vrf_disable() also enqueues installed
* routes for removal from the kernel, unless ZEBRA_VRF_RETAIN is set.
ns_terminate();
zserv_client_list_fini(&zrouter.client_list);
+ zserv_stale_client_list_fini(&zrouter.stale_client_list);
frr_fini();
exit(0);
* function will also clean up all per instance
* capabilities that are exchanged.
*/
-void zebra_gr_stale_client_cleanup(struct list *client_list)
+void zebra_gr_stale_client_cleanup(void)
{
- struct listnode *node, *nnode;
struct zserv *s_client = NULL;
struct client_gr_info *info, *ninfo;
/* Find the stale client */
- for (ALL_LIST_ELEMENTS(client_list, node, nnode, s_client)) {
-
+ frr_each_safe (zserv_stale_client_list, &zrouter.stale_client_list, s_client) {
LOG_GR("%s: Stale client %s is being deleted", __func__,
zebra_route_string(s_client->proto));
}
}
- listnode_add(zrouter.stale_client_list, client);
+ zserv_stale_client_list_add_tail(&zrouter.stale_client_list, client);
return 0;
}
info->vrf_id);
TAILQ_INIT(&(s_client->gr_info_queue));
- listnode_delete(zrouter.stale_client_list, s_client);
+ zserv_stale_client_list_del(&zrouter.stale_client_list, s_client);
if (info->stale_client)
zserv_client_delete(s_client);
XFREE(MTYPE_ZEBRA_GR, info);
*/
static struct zserv *zebra_gr_find_stale_client(struct zserv *client)
{
- struct listnode *node, *nnode;
struct zserv *stale_client;
/* Find the stale client */
- for (ALL_LIST_ELEMENTS(zrouter.stale_client_list, node, nnode,
- stale_client)) {
+ frr_each (zserv_stale_client_list, &zrouter.stale_client_list, stale_client) {
if (client->proto == stale_client->proto
&& client->instance == stale_client->instance) {
return stale_client;
*/
void zebra_gr_client_reconnect(struct zserv *client)
{
- struct listnode *node, *nnode;
struct zserv *old_client = NULL;
struct client_gr_info *info = NULL;
/* Find the stale client */
- for (ALL_LIST_ELEMENTS(zrouter.stale_client_list, node, nnode,
- old_client)) {
- if (client->proto == old_client->proto
- && client->instance == old_client->instance)
- break;
- }
+ old_client = zebra_gr_find_stale_client(client);
/* Copy the timers */
if (!old_client)
}
/* Delete the stale client */
- listnode_delete(zrouter.stale_client_list, old_client);
+ zserv_stale_client_list_del(&zrouter.stale_client_list, old_client);
/* Delete old client */
zserv_client_delete(old_client);
}
/* For managing client list */
PREDECL_LIST(zserv_client_list);
+PREDECL_LIST(zserv_stale_client_list);
/* Client structure. */
struct zserv {
/* For managing this node in the client list */
struct zserv_client_list_item client_list_entry;
+ /* For managing this node in the stale client list */
+ struct zserv_stale_client_list_item stale_client_list_entry;
+
/* Input/output buffer to the client. */
pthread_mutex_t ibuf_mtx;
struct stream_fifo *ibuf_fifo;
/* Declare the list operations */
DECLARE_LIST(zserv_client_list, struct zserv, client_list_entry);
+DECLARE_LIST(zserv_stale_client_list, struct zserv, stale_client_list_entry);
#define ZAPI_HANDLER_ARGS \
struct zserv *client, struct zmsghdr *hdr, struct stream *msg, \
extern void zebra_gr_client_final_shutdown(struct zserv *client);
extern int zebra_gr_client_disconnect(struct zserv *client);
extern void zebra_gr_client_reconnect(struct zserv *client);
-extern void zebra_gr_stale_client_cleanup(struct list *client_list);
+extern void zebra_gr_stale_client_cleanup(void);
extern void zread_client_capabilities(struct zserv *client, struct zmsghdr *hdr,
struct stream *msg,
struct zebra_vrf *zvrf);