]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Add ability to send to all clients updated capability information 3602/head
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 14 Jan 2019 16:08:19 +0000 (11:08 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 31 Jan 2019 14:28:39 +0000 (09:28 -0500)
When capability information changes, allow for resending of data.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra/zapi_msg.c
zebra/zapi_msg.h
zebra/zebra_mlag.c

index e560c2b5a253cd7f616eb584fe50f4da401e3d1d..611d859aaa1cbc8429e1c477c6c9d0132f31b612 100644 (file)
@@ -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)
 {
index 11b469e14478745d1a5da743a661c12f7e281a6b..b770b8e8810c1fab0028c4080ac60deb7c07ead4 100644 (file)
@@ -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);
index a510f2f8d9283b1a1beeb5cac087ebd456f1f6c3..5012cc2a49477d95283e195d56cffcbd4061687b 100644 (file)
@@ -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;
 }