summaryrefslogtreecommitdiff
path: root/zebra/zebra_mlag_private.c
diff options
context:
space:
mode:
authorSatheesh Kumar K <sathk@cumulusnetworks.com>2019-11-12 01:41:04 -0800
committerSatheesh Kumar K <sathk@cumulusnetworks.com>2019-11-13 22:47:32 -0800
commit67fa73f29a2a059fb01d8fc7009161f21e1b05da (patch)
treec2fb737745e0b7e487160e2e3a510866a5e33a28 /zebra/zebra_mlag_private.c
parente05ab0b0c8ecdd76afe972572cff2c0f9cc14574 (diff)
Zebra: ADD Protobuf Encoding & Decoding for MLAG Messages
1. add the Mlag ProtoBuf Lib to Zebra Compilation 2. Encode the messages with protobuf before writing to MLAG 3. Decode the MLAG Messages using protobuf and write to clients based on their subscrption. Signed-off-by: Satheesh Kumar K <sathk@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_mlag_private.c')
-rw-r--r--zebra/zebra_mlag_private.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/zebra/zebra_mlag_private.c b/zebra/zebra_mlag_private.c
index efaaa73c4d..6cb40a9c12 100644
--- a/zebra/zebra_mlag_private.c
+++ b/zebra/zebra_mlag_private.c
@@ -26,6 +26,7 @@
#include "hook.h"
#include "module.h"
#include "thread.h"
+#include "frr_pthread.h"
#include "libfrr.h"
#include "version.h"
#include "network.h"
@@ -70,8 +71,10 @@ int zebra_mlag_private_write_data(uint8_t *data, uint32_t len)
static void zebra_mlag_sched_read(void)
{
- thread_add_read(zmlag_master, zebra_mlag_read, NULL, mlag_socket,
- &zrouter.mlag_info.t_read);
+ frr_with_mutex (&zrouter.mlag_info.mlag_th_mtx) {
+ thread_add_read(zmlag_master, zebra_mlag_read, NULL,
+ mlag_socket, &zrouter.mlag_info.t_read);
+ }
}
static int zebra_mlag_read(struct thread *thread)
@@ -80,8 +83,6 @@ static int zebra_mlag_read(struct thread *thread)
uint32_t h_msglen;
uint32_t tot_len, curr_len = mlag_rd_buf_offset;
- zrouter.mlag_info.t_read = NULL;
-
/*
* Received message in sock_stream looks like below
* | len-1 (4 Bytes) | payload-1 (len-1) |
@@ -103,6 +104,7 @@ static int zebra_mlag_read(struct thread *thread)
zebra_mlag_handle_process_state(MLAG_DOWN);
return -1;
}
+ mlag_rd_buf_offset += data_len;
if (data_len != (ssize_t)ZEBRA_MLAG_LEN_SIZE - curr_len) {
/* Try again later */
zebra_mlag_sched_read();
@@ -131,6 +133,7 @@ static int zebra_mlag_read(struct thread *thread)
zebra_mlag_handle_process_state(MLAG_DOWN);
return -1;
}
+ mlag_rd_buf_offset += data_len;
if (data_len != (ssize_t)tot_len - curr_len) {
/* Try again later */
zebra_mlag_sched_read();