#include "zebra/debug.h"
#include "zebra/zebra_router.h"
#include "zebra/zebra_mlag.h"
-#include "zebra/zebra_mlag_private.h"
#include <sys/un.h>
*
*/
-#ifdef HAVE_CUMULUS
-
static struct thread_master *zmlag_master;
static int mlag_socket;
/*
* Write the data to MLAGD
*/
-int zebra_mlag_private_write_data(uint8_t *data, uint32_t len)
+static int zebra_mlag_private_write_data(uint8_t *data, uint32_t len)
{
int rc = 0;
return -1;
}
mlag_rd_buf_offset += data_len;
- if (data_len != (ssize_t)ZEBRA_MLAG_LEN_SIZE - curr_len) {
+ if (data_len != (ssize_t)(ZEBRA_MLAG_LEN_SIZE - curr_len)) {
/* Try again later */
zebra_mlag_sched_read();
return 0;
return -1;
}
mlag_rd_buf_offset += data_len;
- if (data_len != (ssize_t)tot_len - curr_len) {
+ if (data_len != (ssize_t)(tot_len - curr_len)) {
/* Try again later */
zebra_mlag_sched_read();
return 0;
/*
* Currently we are doing polling later we will look for better options
*/
-void zebra_mlag_private_monitor_state(void)
+static int zebra_mlag_private_monitor_state(void)
{
thread_add_event(zmlag_master, zebra_mlag_connect, NULL, 0,
&zrouter.mlag_info.t_read);
+ return 0;
}
-int zebra_mlag_private_open_channel(void)
+static int zebra_mlag_private_open_channel(void)
{
zmlag_master = zrouter.mlag_info.th_master;
return 0;
}
-int zebra_mlag_private_close_channel(void)
+static int zebra_mlag_private_close_channel(void)
{
if (zmlag_master == NULL)
return -1;
return 0;
}
-void zebra_mlag_private_cleanup_data(void)
+static int zebra_mlag_private_cleanup_data(void)
{
zmlag_master = NULL;
zrouter.mlag_info.connected = false;
zrouter.mlag_info.timer_running = false;
close(mlag_socket);
-}
-
-#else /*HAVE_CUMULUS */
-
-int zebra_mlag_private_write_data(uint8_t *data, uint32_t len)
-{
return 0;
}
-void zebra_mlag_private_monitor_state(void)
-{
-}
-
-int zebra_mlag_private_open_channel(void)
+static int zebra_mlag_module_init(void)
{
+ hook_register(zebra_mlag_private_write_data,
+ zebra_mlag_private_write_data);
+ hook_register(zebra_mlag_private_monitor_state,
+ zebra_mlag_private_monitor_state);
+ hook_register(zebra_mlag_private_open_channel,
+ zebra_mlag_private_open_channel);
+ hook_register(zebra_mlag_private_close_channel,
+ zebra_mlag_private_close_channel);
+ hook_register(zebra_mlag_private_cleanup_data,
+ zebra_mlag_private_cleanup_data);
return 0;
}
-int zebra_mlag_private_close_channel(void)
-{
- return 0;
-}
-
-void zebra_mlag_private_cleanup_data(void)
-{
-}
-#endif /*HAVE_CUMULUS*/
+FRR_MODULE_SETUP(
+ .name = "zebra_cumulus_mlag",
+ .version = FRR_VERSION,
+ .description = "zebra Cumulus MLAG interface",
+ .init = zebra_mlag_module_init,
+)