]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Add mlag information to zrouter
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 11 Jan 2019 18:17:45 +0000 (13:17 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 31 Jan 2019 14:20:46 +0000 (09:20 -0500)
Since this is zebra router global level information
store mlag data in the zrouter structure.

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

index 35be07c024e60679d6d40db4e89ac4fd1b42f773..a510f2f8d9283b1a1beeb5cac087ebd456f1f6c3 100644 (file)
 #include "hook.h"
 
 #include "zebra/zebra_mlag.h"
+#include "zebra/zebra_router.h"
 
 #ifndef VTYSH_EXTRACT_PL
 #include "zebra/zebra_mlag_clippy.c"
 #endif
 
-enum mlag_role role = MLAG_ROLE_NONE;
-
 enum mlag_role zebra_mlag_get_role(void)
 {
-       return role;
+       return zrouter.mlag_info.role;
 }
 
 DEFUN_HIDDEN (show_mlag,
@@ -47,7 +46,7 @@ DEFUN_HIDDEN (show_mlag,
        char buf[80];
 
        vty_out(vty, "MLag is configured to: %s\n",
-               mlag_role2str(role, buf, sizeof(buf)));
+               mlag_role2str(zrouter.mlag_info.role, buf, sizeof(buf)));
 
        return CMD_SUCCESS;
 }
@@ -63,11 +62,11 @@ DEFPY_HIDDEN (test_mlag,
              "Mlag is setup to be the secondary\n")
 {
        if (none)
-               role = MLAG_ROLE_NONE;
+               zrouter.mlag_info.role = MLAG_ROLE_NONE;
        if (primary)
-               role = MLAG_ROLE_PRIMARY;
+               zrouter.mlag_info.role = MLAG_ROLE_PRIMARY;
        if (secondary)
-               role = MLAG_ROLE_SECONDARY;
+               zrouter.mlag_info.role = MLAG_ROLE_SECONDARY;
 
        return CMD_SUCCESS;
 }
index 332a4c3f95595b1be7905aecc27fe1df298bc537..fb28495917ab9990cebc06be458598cb0c3a7cfb 100644 (file)
@@ -22,6 +22,8 @@
 #ifndef __ZEBRA_ROUTER_H__
 #define __ZEBRA_ROUTER_H__
 
+#include "lib/mlag.h"
+
 #include "zebra/zebra_ns.h"
 
 /*
@@ -44,6 +46,18 @@ RB_HEAD(zebra_router_table_head, zebra_router_table);
 RB_PROTOTYPE(zebra_router_table_head, zebra_router_table,
             zebra_router_table_entry, zebra_router_table_entry_compare)
 
+struct zebra_mlag_info {
+       /* Role this zebra router is playing */
+       enum mlag_role role;
+
+       /* The peerlink being used for mlag */
+       char *peerlink;
+       ifindex_t peerlink_ifindex;
+
+       /* The system mac being used */
+       struct ethaddr mac;
+};
+
 struct zebra_router {
        /* Thread master */
        struct thread_master *master;
@@ -87,6 +101,9 @@ struct zebra_router {
 
 #define ZEBRA_ZAPI_PACKETS_TO_PROCESS 1000
        _Atomic uint32_t packets_to_process;
+
+       /* Mlag information for the router */
+       struct zebra_mlag_info mlag_info;
 };
 
 extern struct zebra_router zrouter;