From 414d885aacb6cedb9ffee496739ee32e6235d3cb Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 14 Jan 2019 10:43:53 -0500 Subject: [PATCH] pimd: Add hidden 'ip pim active-active` command Add a command to track if an interface should be in active-active mode or not. This command is hidden at this time because it is not finished fully. Signed-off-by: Donald Sharp --- pimd/pim_cmd.c | 30 ++++++++++++++++++++++++++++++ pimd/pim_iface.c | 2 ++ pimd/pim_iface.h | 3 +++ pimd/pim_vty.c | 3 +++ pimd/subdir.am | 3 +++ 5 files changed, 41 insertions(+) diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 7089e21513..2c19d061a8 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -62,6 +62,10 @@ #include "pim_bfd.h" #include "bfd.h" +#ifndef VTYSH_EXTRACT_PL +#include "pimd/pim_cmd_clippy.c" +#endif + static struct cmd_node interface_node = { INTERFACE_NODE, "%s(config-if)# ", 1 /* vtysh ? yes */ }; @@ -6394,6 +6398,31 @@ static int pim_cmd_interface_add(struct interface *ifp) return 1; } +DEFPY_HIDDEN (interface_ip_pim_activeactive, + interface_ip_pim_activeactive_cmd, + "[no$no] ip pim active-active", + NO_STR + IP_STR + PIM_STR + "Mark interface as Active-Active for MLAG operations, Hidden because not finished yet\n") +{ + VTY_DECLVAR_CONTEXT(interface, ifp); + struct pim_interface *pim_ifp; + + if (!no && !pim_cmd_interface_add(ifp)) { + vty_out(vty, "Could not enable PIM SM active-active on interface\n"); + return CMD_WARNING_CONFIG_FAILED; + } + + pim_ifp = ifp->info; + if (no) + pim_ifp->activeactive = false; + else + pim_ifp->activeactive = true; + + return CMD_SUCCESS; +} + DEFUN_HIDDEN (interface_ip_pim_ssm, interface_ip_pim_ssm_cmd, "ip pim ssm", @@ -8722,6 +8751,7 @@ void pim_cmd_init(void) &interface_ip_igmp_query_max_response_time_dsec_cmd); install_element(INTERFACE_NODE, &interface_no_ip_igmp_query_max_response_time_dsec_cmd); + install_element(INTERFACE_NODE, &interface_ip_pim_activeactive_cmd); install_element(INTERFACE_NODE, &interface_ip_pim_ssm_cmd); install_element(INTERFACE_NODE, &interface_no_ip_pim_ssm_cmd); install_element(INTERFACE_NODE, &interface_ip_pim_sm_cmd); diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c index 0451ab1e71..6933f4d5bd 100644 --- a/pimd/pim_iface.c +++ b/pimd/pim_iface.c @@ -170,6 +170,8 @@ struct pim_interface *pim_if_new(struct interface *ifp, bool igmp, bool pim, pim_ifp->sec_addr_list->cmp = (int (*)(void *, void *))pim_sec_addr_comp; + pim_ifp->activeactive = false; + RB_INIT(pim_ifchannel_rb, &pim_ifp->ifchannel_rb); ifp->info = pim_ifp; diff --git a/pimd/pim_iface.h b/pimd/pim_iface.h index a7dc097f88..5066998cb5 100644 --- a/pimd/pim_iface.h +++ b/pimd/pim_iface.h @@ -124,6 +124,9 @@ struct pim_interface { /* boundary prefix-list */ char *boundary_oil_plist; + /* Turn on Active-Active for this interface */ + bool activeactive; + int64_t pim_ifstat_start; /* start timestamp for stats */ uint32_t pim_ifstat_hello_sent; uint32_t pim_ifstat_hello_sendfail; diff --git a/pimd/pim_vty.c b/pimd/pim_vty.c index f6385a0ac9..6495788748 100644 --- a/pimd/pim_vty.c +++ b/pimd/pim_vty.c @@ -362,6 +362,9 @@ int pim_interface_config_write(struct vty *vty) } } + if (pim_ifp->activeactive) + vty_out(vty, " ip pim active-active\n"); + /* boundary */ if (pim_ifp->boundary_oil_plist) { vty_out(vty, diff --git a/pimd/subdir.am b/pimd/subdir.am index 99701430c5..7d8df7d105 100644 --- a/pimd/subdir.am +++ b/pimd/subdir.am @@ -115,6 +115,9 @@ noinst_HEADERS += \ pimd/mtracebis_routeget.h \ # end +pimd/pim_cmd_clippy.c: $(CLIPPY_DEPS) +pimd/pim_cmd.$(OBJEXT): pimd/pim_cmd_clippy.c + pimd_pimd_LDADD = pimd/libpim.a lib/libfrr.la $(LIBCAP) pimd_pimd_SOURCES = pimd/pim_main.c -- 2.39.5