From b120fe3b69208980372d04728ee57894b6a7a842 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 14 Jan 2019 11:08:19 -0500 Subject: [PATCH] zebra: Add ability to send to all clients updated capability information When capability information changes, allow for resending of data. Signed-off-by: Donald Sharp --- zebra/zapi_msg.c | 12 ++++++++++++ zebra/zapi_msg.h | 2 ++ zebra/zebra_mlag.c | 13 +++++++++++++ 3 files changed, 27 insertions(+) diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index e560c2b5a2..611d859aaa 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -1675,6 +1675,18 @@ static void zsend_capabilities(struct zserv *client, struct zebra_vrf *zvrf) zserv_send_message(client, s); } +void zsend_capabilities_all_clients(void) +{ + struct listnode *node, *nnode; + struct zebra_vrf *zvrf; + struct zserv *client; + + zvrf = vrf_info_lookup(VRF_DEFAULT); + for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) { + zsend_capabilities(client, zvrf); + } +} + /* Tie up route-type and client->sock */ static void zread_hello(ZAPI_HANDLER_ARGS) { diff --git a/zebra/zapi_msg.h b/zebra/zapi_msg.h index 11b469e144..b770b8e881 100644 --- a/zebra/zapi_msg.h +++ b/zebra/zapi_msg.h @@ -84,3 +84,5 @@ extern void zsend_iptable_notify_owner(struct zebra_pbr_iptable *iptable, enum zapi_iptable_notify_owner note); extern void zserv_nexthop_num_warn(const char *caller, const struct prefix *p, const unsigned int nexthop_num); + +extern void zsend_capabilities_all_clients(void); diff --git a/zebra/zebra_mlag.c b/zebra/zebra_mlag.c index a510f2f8d9..5012cc2a49 100644 --- a/zebra/zebra_mlag.c +++ b/zebra/zebra_mlag.c @@ -26,6 +26,8 @@ #include "zebra/zebra_mlag.h" #include "zebra/zebra_router.h" +#include "zebra/zapi_msg.h" +#include "zebra/debug.h" #ifndef VTYSH_EXTRACT_PL #include "zebra/zebra_mlag_clippy.c" @@ -61,6 +63,9 @@ DEFPY_HIDDEN (test_mlag, "Mlag is setup to be primary\n" "Mlag is setup to be the secondary\n") { + enum mlag_role orig = zrouter.mlag_info.role; + char buf1[80], buf2[80]; + if (none) zrouter.mlag_info.role = MLAG_ROLE_NONE; if (primary) @@ -68,6 +73,14 @@ DEFPY_HIDDEN (test_mlag, if (secondary) zrouter.mlag_info.role = MLAG_ROLE_SECONDARY; + if (IS_ZEBRA_DEBUG_MLAG) + zlog_debug("Test: Changing role from %s to %s", + mlag_role2str(orig, buf1, sizeof(buf1)), + mlag_role2str(orig, buf2, sizeof(buf2))); + + if (orig != zrouter.mlag_info.role) + zsend_capabilities_all_clients(); + return CMD_SUCCESS; } -- 2.39.5