dnl V6 headers are checked below, after we check for v6
+is_linux=false
+
AC_MSG_CHECKING([which operating system interface to use])
case "$host_os" in
sunos* | solaris2*)
dnl how to fix it but no real progress on implementation
dnl when they fix it, remove this
AC_DEFINE([IPV6_MINHOPCOUNT], [73], [Linux ipv6 Min Hop Count])
+
+ is_linux=true
;;
openbsd*)
AC_MSG_RESULT([OpenBSD])
;;
esac
AM_CONDITIONAL([SOLARIS], [test "${SOLARIS}" = "solaris"])
+AM_CONDITIONAL([LINUX], [${is_linux}])
AC_SYS_LARGEFILE
usr/lib/frr/*d
usr/lib/frr/watchfrr
usr/lib/frr/zebra
+usr/lib/*/frr/modules/zebra_cumulus_mlag.so
usr/lib/*/frr/modules/zebra_irdp.so
usr/lib/*/frr/modules/zebra_fpm.so
usr/lib/*/frr/modules/bgpd_bmp.so
%if %{with_rpki}
%{_libdir}/frr/modules/bgpd_rpki.so
%endif
+%{_libdir}/frr/modules/zebra_cumulus_mlag.so
%{_libdir}/frr/modules/zebra_irdp.so
%{_libdir}/frr/modules/bgpd_bmp.so
%{_bindir}/*
if FPM
module_LTLIBRARIES += zebra/zebra_fpm.la
endif
+if LINUX
+module_LTLIBRARIES += zebra/zebra_cumulus_mlag.la
+endif
man8 += $(MANBUILD)/zebra.8
## endif ZEBRA
zebra/rule_netlink.c \
zebra/rule_socket.c \
zebra/zebra_mlag.c \
- zebra/zebra_mlag_private.c \
zebra/zebra_l2.c \
zebra/zebra_memory.c \
zebra/zebra_dplane.c \
zebra/rtadv.h \
zebra/rule_netlink.h \
zebra/zebra_mlag.h \
- zebra/zebra_mlag_private.h \
zebra/zebra_fpm_private.h \
zebra/zebra_l2.h \
zebra/zebra_dplane.h \
zebra_zebra_fpm_la_SOURCES += zebra/zebra_fpm_dt.c
endif
endif
+
+zebra_zebra_cumulus_mlag_la_SOURCES = zebra/zebra_mlag_private.c
+zebra_zebra_cumulus_mlag_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
#include "mlag.h"
#include "zebra/zebra_mlag.h"
-#include "zebra/zebra_mlag_private.h"
#include "zebra/zebra_router.h"
#include "zebra/zebra_memory.h"
#include "zebra/zapi_msg.h"
#include "zebra/zebra_mlag_clippy.c"
#endif
+DEFINE_HOOK(zebra_mlag_private_write_data,
+ (uint8_t *data, uint32_t len), (data, len))
+DEFINE_HOOK(zebra_mlag_private_monitor_state, (), ())
+DEFINE_HOOK(zebra_mlag_private_open_channel, (), ())
+DEFINE_HOOK(zebra_mlag_private_close_channel, (), ())
+DEFINE_HOOK(zebra_mlag_private_cleanup_data, (), ())
+
#define ZEBRA_MLAG_METADATA_LEN 4
#define ZEBRA_MLAG_MSG_BCAST 0xFFFFFFFF
* write to MCLAGD
*/
if (len > 0) {
- zebra_mlag_private_write_data(mlag_wr_buffer, len);
+ hook_call(zebra_mlag_private_write_data,
+ mlag_wr_buffer, len);
/*
* If message type is De-register, send a signal to main
} else if (state == MLAG_DOWN) {
zrouter.mlag_info.connected = false;
zebra_mlag_publish_process_state(NULL, ZEBRA_MLAG_PROCESS_DOWN);
- zebra_mlag_private_monitor_state();
+ hook_call(zebra_mlag_private_monitor_state);
}
}
/*
* Send Notification to clean private data
*/
- zebra_mlag_private_cleanup_data();
+ hook_call(zebra_mlag_private_cleanup_data);
return 0;
}
"First client, opening the channel with MLAG");
zebra_mlag_spawn_pthread();
- rc = zebra_mlag_private_open_channel();
+ rc = hook_call(zebra_mlag_private_open_channel);
if (rc < 0) {
/*
* For some reason, zebra not able to open the
* signal back to main thread to do the thread cleanup
* this was mainly to make sure De-register is posted to MCLAGD.
*/
- zebra_mlag_private_close_channel();
+ hook_call(zebra_mlag_private_close_channel);
}
if (IS_ZEBRA_DEBUG_MLAG)
zebra_mlag_spawn_pthread();
zrouter.mlag_info.clients_interested_cnt++;
test_mlag_in_progress = true;
- zebra_mlag_private_open_channel();
+ hook_call(zebra_mlag_private_open_channel);
}
} else {
if (test_mlag_in_progress == true) {
test_mlag_in_progress = false;
zrouter.mlag_info.clients_interested_cnt--;
- zebra_mlag_private_close_channel();
+ hook_call(zebra_mlag_private_close_channel);
}
}
}
#define ZEBRA_MLAG_BUF_LIMIT 2048
#define ZEBRA_MLAG_LEN_SIZE 4
+DECLARE_HOOK(zebra_mlag_private_write_data,
+ (uint8_t *data, uint32_t len), (data, len))
+DECLARE_HOOK(zebra_mlag_private_monitor_state, (), ())
+DECLARE_HOOK(zebra_mlag_private_open_channel, (), ())
+DECLARE_HOOK(zebra_mlag_private_close_channel, (), ())
+DECLARE_HOOK(zebra_mlag_private_cleanup_data, (), ())
+
extern uint8_t mlag_wr_buffer[ZEBRA_MLAG_BUF_LIMIT];
extern uint8_t mlag_rd_buffer[ZEBRA_MLAG_BUF_LIMIT];
extern uint32_t mlag_rd_buf_offset;
#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;
/*
* 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,
+)
+++ /dev/null
-/*
- * This is an implementation of MLAG Functionality
- *
- * Module name: Zebra MLAG
- *
- * Author: sathesh Kumar karra <sathk@cumulusnetworks.com>
- *
- * Copyright (C) 2019 Cumulus Networks http://www.cumulusnetworks.com
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef __ZEBRA_MLAG_PRIVATE_H__
-#define __ZEBRA_MLAG_PRIVATE_H__
-
-
-/*
- * all the platform specific API's
- */
-
-int zebra_mlag_private_open_channel(void);
-int zebra_mlag_private_close_channel(void);
-void zebra_mlag_private_monitor_state(void);
-int zebra_mlag_private_write_data(uint8_t *data, uint32_t len);
-void zebra_mlag_private_cleanup_data(void);
-#endif