summaryrefslogtreecommitdiffstats
path: root/lib/mlag.h
diff options
context:
space:
mode:
authorSatheesh Kumar K <sathk@cumulusnetworks.com>2019-08-26 11:18:05 +0200
committerSatheesh Kumar K <sathk@cumulusnetworks.com>2019-09-24 10:35:09 +0200
commit5fdca4ded5794dcf97235fa3f2d1f0e7e0969c29 (patch)
treedd9bfe9f888c0287e3ad40ebd91f64645f0ed4f1 /lib/mlag.h
parentpimd : Add support for MLAG Register & Un-register (diff)
downloadfrr-5fdca4ded5794dcf97235fa3f2d1f0e7e0969c29.tar.xz
frr-5fdca4ded5794dcf97235fa3f2d1f0e7e0969c29.zip
pimd, lib: adding support for MLAG Message processing at PIM
This includes: 1. Defining message formats 2. Stream Decoding after receiving the message at PIM 3. Handling MLAG UP & Down Notifications Signed-off-by: Satheesh Kumar K <sathk@cumulusnetworks.com>
Diffstat (limited to 'lib/mlag.h')
-rw-r--r--lib/mlag.h84
1 files changed, 83 insertions, 1 deletions
diff --git a/lib/mlag.h b/lib/mlag.h
index d461fdc44..b93d5b749 100644
--- a/lib/mlag.h
+++ b/lib/mlag.h
@@ -26,6 +26,10 @@
extern "C" {
#endif
+#include "lib/if.h"
+#include "lib/vrf.h"
+#include "lib/stream.h"
+
#define MLAG_BUF_LIMIT 2048
enum mlag_role {
@@ -34,9 +38,26 @@ enum mlag_role {
MLAG_ROLE_SECONDARY
};
+enum mlag_state {
+ MLAG_STATE_DOWN,
+ MLAG_STATE_RUNNING,
+};
+
+enum mlag_frr_state {
+ MLAG_FRR_STATE_NONE,
+ MLAG_FRR_STATE_DOWN,
+ MLAG_FRR_STATE_UP,
+};
+
+enum mlag_owner {
+ MLAG_OWNER_NONE,
+ MLAG_OWNER_INTERFACE,
+ MLAG_OWNER_VXLAN,
+};
+
/*
* This message definition should match mlag.proto
- * Beacuse mesasge registartion is based on this
+ * Because message registration is based on this
*/
enum mlag_msg_type {
MLAG_MSG_NONE = 0,
@@ -53,7 +74,68 @@ enum mlag_msg_type {
MLAG_PEER_FRR_STATUS = 12,
};
+struct mlag_frr_status {
+ enum mlag_frr_state frr_state;
+};
+
+struct mlag_status {
+ char peerlink_rif[INTERFACE_NAMSIZ];
+ enum mlag_role my_role;
+ enum mlag_state peer_state;
+};
+
+#define MLAG_ROLE_STRSIZE 16
+
+struct mlag_vxlan {
+ uint32_t anycast_ip;
+ uint32_t local_ip;
+};
+
+struct mlag_mroute_add {
+ char vrf_name[VRF_NAMSIZ];
+ uint32_t source_ip;
+ uint32_t group_ip;
+ uint32_t cost_to_rp;
+ enum mlag_owner owner_id;
+ uint8_t am_i_dr;
+ uint8_t am_i_dual_active;
+ uint32_t vrf_id;
+ char intf_name[INTERFACE_NAMSIZ];
+};
+
+struct mlag_mroute_del {
+ char vrf_name[VRF_NAMSIZ];
+ uint32_t source_ip;
+ uint32_t group_ip;
+ enum mlag_owner owner_id;
+ uint32_t vrf_id;
+ char intf_name[INTERFACE_NAMSIZ];
+};
+
+struct mlag_msg {
+ enum mlag_msg_type msg_type;
+ uint16_t data_len;
+ uint16_t msg_cnt;
+ uint8_t data[0];
+};
+
+
extern char *mlag_role2str(enum mlag_role role, char *buf, size_t size);
+extern char *zebra_mlag_lib_msgid_to_str(enum mlag_msg_type msg_type, char *buf,
+ size_t size);
+extern int zebra_mlag_lib_decode_mlag_hdr(struct stream *s,
+ struct mlag_msg *msg);
+extern int zebra_mlag_lib_decode_mroute_add(struct stream *s,
+ struct mlag_mroute_add *msg);
+extern int zebra_mlag_lib_decode_mroute_del(struct stream *s,
+ struct mlag_mroute_del *msg);
+extern int zebra_mlag_lib_decode_mlag_status(struct stream *s,
+ struct mlag_status *msg);
+extern int zebra_mlag_lib_decode_vxlan_update(struct stream *s,
+ struct mlag_vxlan *msg);
+
+extern int zebra_mlag_lib_decode_frr_status(struct stream *s,
+ struct mlag_frr_status *msg);
#ifdef __cplusplus
}