summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_evpn_vty.c10
-rw-r--r--bgpd/bgp_rpki.c2
-rw-r--r--bgpd/bgp_vty.c2
-rw-r--r--lib/command.c4
-rw-r--r--ospfd/ospf_vty.c4
-rw-r--r--pbrd/pbr_vty.c2
-rw-r--r--pimd/pim6_cmd.c231
-rw-r--r--pimd/pim6_cmd.h44
-rw-r--r--pimd/pim6_main.c9
-rw-r--r--pimd/pim6_stubs.c6
-rw-r--r--pimd/pim_addr.h4
-rw-r--r--pimd/pim_bfd.c6
-rw-r--r--pimd/pim_bsm.c4
-rw-r--r--pimd/pim_cmd.c310
-rw-r--r--pimd/pim_cmd_common.c328
-rw-r--r--pimd/pim_cmd_common.h39
-rw-r--r--pimd/pim_static.c4
-rw-r--r--pimd/pim_vty.c286
-rw-r--r--pimd/pim_vty.h3
-rw-r--r--pimd/pimd.c4
-rw-r--r--pimd/subdir.am14
-rw-r--r--sharpd/sharp_vty.c2
-rwxr-xr-xvtysh/extract.pl.in6
-rw-r--r--vtysh/vtysh.c1
-rw-r--r--vtysh/vtysh.h9
-rw-r--r--zebra/zebra_vty.c2
26 files changed, 870 insertions, 466 deletions
diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c
index caf0444850..557f4ce125 100644
--- a/bgpd/bgp_evpn_vty.c
+++ b/bgpd/bgp_evpn_vty.c
@@ -3865,19 +3865,19 @@ DEFUN (bgp_evpn_advertise_type5,
if (!(afi == AFI_IP || afi == AFI_IP6)) {
vty_out(vty,
- "%%only ipv4 or ipv6 address families are supported");
+ "%%only ipv4 or ipv6 address families are supported\n");
return CMD_WARNING;
}
if (safi != SAFI_UNICAST) {
vty_out(vty,
- "%%only ipv4 unicast or ipv6 unicast are supported");
+ "%%only ipv4 unicast or ipv6 unicast are supported\n");
return CMD_WARNING;
}
if ((oly != OVERLAY_INDEX_TYPE_NONE)
&& (oly != OVERLAY_INDEX_GATEWAY_IP)) {
- vty_out(vty, "%%Unknown overlay-index type specified");
+ vty_out(vty, "%%Unknown overlay-index type specified\n");
return CMD_WARNING;
}
@@ -4056,13 +4056,13 @@ DEFUN (no_bgp_evpn_advertise_type5,
if (!(afi == AFI_IP || afi == AFI_IP6)) {
vty_out(vty,
- "%%only ipv4 or ipv6 address families are supported");
+ "%%only ipv4 or ipv6 address families are supported\n");
return CMD_WARNING;
}
if (safi != SAFI_UNICAST) {
vty_out(vty,
- "%%only ipv4 unicast or ipv6 unicast are supported");
+ "%%only ipv4 unicast or ipv6 unicast are supported\n");
return CMD_WARNING;
}
diff --git a/bgpd/bgp_rpki.c b/bgpd/bgp_rpki.c
index 5d1ae766e2..857462a601 100644
--- a/bgpd/bgp_rpki.c
+++ b/bgpd/bgp_rpki.c
@@ -1261,7 +1261,7 @@ DEFPY (show_rpki_prefix,
if (pfx_table_validate_r(rtr_config->pfx_table, &matches, &match_count,
asn, &addr, prefix->prefixlen, &result)
!= PFX_SUCCESS) {
- vty_out(vty, "Prefix lookup failed");
+ vty_out(vty, "Prefix lookup failed\n");
return CMD_WARNING;
}
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index afe4c7ae6f..d21e257cb5 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -8566,7 +8566,7 @@ DEFPY (af_sid_vpn_export,
if (!yes) {
/* implement me */
- vty_out(vty, "It's not implemented");
+ vty_out(vty, "It's not implemented\n");
return CMD_WARNING_CONFIG_FAILED;
}
diff --git a/lib/command.c b/lib/command.c
index ebdbf162d1..1989668bf0 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -2239,9 +2239,9 @@ DEFUN (banner_motd_file,
int cmd = cmd_banner_motd_file(filename);
if (cmd == CMD_ERR_NO_FILE)
- vty_out(vty, "%s does not exist", filename);
+ vty_out(vty, "%s does not exist\n", filename);
else if (cmd == CMD_WARNING_CONFIG_FAILED)
- vty_out(vty, "%s must be in %s", filename, SYSCONFDIR);
+ vty_out(vty, "%s must be in %s\n", filename, SYSCONFDIR);
return cmd;
}
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 0b7c3c6831..780521bfe4 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -9705,7 +9705,7 @@ DEFUN (ospf_max_metric_router_lsa_startup,
unsigned int seconds;
if (argc < 4) {
- vty_out(vty, "%% Must supply stub-router period");
+ vty_out(vty, "%% Must supply stub-router period\n");
return CMD_WARNING_CONFIG_FAILED;
}
@@ -9761,7 +9761,7 @@ DEFUN (ospf_max_metric_router_lsa_shutdown,
unsigned int seconds;
if (argc < 4) {
- vty_out(vty, "%% Must supply stub-router shutdown period");
+ vty_out(vty, "%% Must supply stub-router shutdown period\n");
return CMD_WARNING_CONFIG_FAILED;
}
diff --git a/pbrd/pbr_vty.c b/pbrd/pbr_vty.c
index 21c1409e91..b5946bd40d 100644
--- a/pbrd/pbr_vty.c
+++ b/pbrd/pbr_vty.c
@@ -358,7 +358,7 @@ DEFPY(pbr_map_match_mark, pbr_map_match_mark_cmd,
struct pbr_map_sequence *pbrms = VTY_GET_CONTEXT(pbr_map_sequence);
#ifndef GNU_LINUX
- vty_out(vty, "pbr marks are not supported on this platform");
+ vty_out(vty, "pbr marks are not supported on this platform\n");
return CMD_WARNING_CONFIG_FAILED;
#endif
diff --git a/pimd/pim6_cmd.c b/pimd/pim6_cmd.c
new file mode 100644
index 0000000000..06790d3d63
--- /dev/null
+++ b/pimd/pim6_cmd.c
@@ -0,0 +1,231 @@
+/*
+ * PIM for IPv6 FRR
+ * Copyright (C) 2022 Vmware, Inc.
+ * Mobashshera Rasool <mrasool@vmware.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
+ */
+
+#include <zebra.h>
+
+#include "lib/json.h"
+#include "command.h"
+#include "if.h"
+#include "prefix.h"
+#include "zclient.h"
+#include "plist.h"
+#include "hash.h"
+#include "nexthop.h"
+#include "vrf.h"
+#include "ferr.h"
+
+#include "pimd.h"
+#include "pim6_cmd.h"
+#include "pim_vty.h"
+#include "lib/northbound_cli.h"
+#include "pim_errors.h"
+#include "pim_nb.h"
+#include "pim_cmd_common.h"
+
+#ifndef VTYSH_EXTRACT_PL
+#include "pimd/pim6_cmd_clippy.c"
+#endif
+
+DEFPY (ipv6_pim_joinprune_time,
+ ipv6_pim_joinprune_time_cmd,
+ "ipv6 pim join-prune-interval (1-65535)$jpi",
+ IPV6_STR
+ PIM_STR
+ "Join Prune Send Interval\n"
+ "Seconds\n")
+{
+ return pim_process_join_prune_cmd(vty, jpi_str);
+}
+
+DEFPY (no_ipv6_pim_joinprune_time,
+ no_ipv6_pim_joinprune_time_cmd,
+ "no ipv6 pim join-prune-interval [(1-65535)]",
+ NO_STR
+ IPV6_STR
+ PIM_STR
+ "Join Prune Send Interval\n"
+ IGNORED_IN_NO_STR)
+{
+ return pim_process_no_join_prune_cmd(vty);
+}
+
+DEFPY (ipv6_pim_spt_switchover_infinity,
+ ipv6_pim_spt_switchover_infinity_cmd,
+ "ipv6 pim spt-switchover infinity-and-beyond",
+ IPV6_STR
+ PIM_STR
+ "SPT-Switchover\n"
+ "Never switch to SPT Tree\n")
+{
+ return pim_process_spt_switchover_infinity_cmd(vty);
+}
+
+DEFPY (ipv6_pim_spt_switchover_infinity_plist,
+ ipv6_pim_spt_switchover_infinity_plist_cmd,
+ "ipv6 pim spt-switchover infinity-and-beyond prefix-list WORD$plist",
+ IPV6_STR
+ PIM_STR
+ "SPT-Switchover\n"
+ "Never switch to SPT Tree\n"
+ "Prefix-List to control which groups to switch\n"
+ "Prefix-List name\n")
+{
+ return pim_process_spt_switchover_prefixlist_cmd(vty, plist);
+}
+
+DEFPY (no_ipv6_pim_spt_switchover_infinity,
+ no_ipv6_pim_spt_switchover_infinity_cmd,
+ "no ipv6 pim spt-switchover infinity-and-beyond",
+ NO_STR
+ IPV6_STR
+ PIM_STR
+ "SPT_Switchover\n"
+ "Never switch to SPT Tree\n")
+{
+ return pim_process_no_spt_switchover_cmd(vty);
+}
+
+DEFPY (no_ipv6_pim_spt_switchover_infinity_plist,
+ no_ipv6_pim_spt_switchover_infinity_plist_cmd,
+ "no ipv6 pim spt-switchover infinity-and-beyond prefix-list WORD",
+ NO_STR
+ IPV6_STR
+ PIM_STR
+ "SPT_Switchover\n"
+ "Never switch to SPT Tree\n"
+ "Prefix-List to control which groups to switch\n"
+ "Prefix-List name\n")
+{
+ return pim_process_no_spt_switchover_cmd(vty);
+}
+
+DEFPY (ipv6_pim_packets,
+ ipv6_pim_packets_cmd,
+ "ipv6 pim packets (1-255)",
+ IPV6_STR
+ PIM_STR
+ "packets to process at one time per fd\n"
+ "Number of packets\n")
+{
+ return pim_process_pim_packet_cmd(vty, packets_str);
+}
+
+DEFPY (no_ipv6_pim_packets,
+ no_ipv6_pim_packets_cmd,
+ "no ipv6 pim packets [(1-255)]",
+ NO_STR
+ IPV6_STR
+ PIM_STR
+ "packets to process at one time per fd\n"
+ IGNORED_IN_NO_STR)
+{
+ return pim_process_no_pim_packet_cmd(vty);
+}
+
+DEFPY (ipv6_pim_keep_alive,
+ ipv6_pim_keep_alive_cmd,
+ "ipv6 pim keep-alive-timer (1-65535)$kat",
+ IPV6_STR
+ PIM_STR
+ "Keep alive Timer\n"
+ "Seconds\n")
+{
+ return pim_process_keepalivetimer_cmd(vty, kat_str);
+}
+
+DEFPY (no_ipv6_pim_keep_alive,
+ no_ipv6_pim_keep_alive_cmd,
+ "no ipv6 pim keep-alive-timer [(1-65535)]",
+ NO_STR
+ IPV6_STR
+ PIM_STR
+ "Keep alive Timer\n"
+ IGNORED_IN_NO_STR)
+{
+ return pim_process_no_keepalivetimer_cmd(vty);
+}
+
+DEFPY (ipv6_pim_rp_keep_alive,
+ ipv6_pim_rp_keep_alive_cmd,
+ "ipv6 pim rp keep-alive-timer (1-65535)$kat",
+ IPV6_STR
+ PIM_STR
+ "Rendevous Point\n"
+ "Keep alive Timer\n"
+ "Seconds\n")
+{
+ return pim_process_rp_kat_cmd(vty, kat_str);
+}
+
+DEFPY (no_ipv6_pim_rp_keep_alive,
+ no_ipv6_pim_rp_keep_alive_cmd,
+ "no ipv6 pim rp keep-alive-timer [(1-65535)]",
+ NO_STR
+ IPV6_STR
+ PIM_STR
+ "Rendevous Point\n"
+ "Keep alive Timer\n"
+ IGNORED_IN_NO_STR)
+{
+ return pim_process_no_rp_kat_cmd(vty);
+}
+
+DEFPY (ipv6_pim_register_suppress,
+ ipv6_pim_register_suppress_cmd,
+ "ipv6 pim register-suppress-time (1-65535)$rst",
+ IPV6_STR
+ PIM_STR
+ "Register Suppress Timer\n"
+ "Seconds\n")
+{
+ return pim_process_register_suppress_cmd(vty, rst_str);
+}
+
+DEFPY (no_ipv6_pim_register_suppress,
+ no_ipv6_pim_register_suppress_cmd,
+ "no ipv6 pim register-suppress-time [(1-65535)]",
+ NO_STR
+ IPV6_STR
+ PIM_STR
+ "Register Suppress Timer\n"
+ IGNORED_IN_NO_STR)
+{
+ return pim_process_no_register_suppress_cmd(vty);
+}
+
+void pim_cmd_init(void)
+{
+ if_cmd_init(pim_interface_config_write);
+
+ install_element(CONFIG_NODE, &ipv6_pim_joinprune_time_cmd);
+ install_element(CONFIG_NODE, &no_ipv6_pim_joinprune_time_cmd);
+ install_element(CONFIG_NODE, &ipv6_pim_spt_switchover_infinity_cmd);
+ install_element(CONFIG_NODE, &ipv6_pim_spt_switchover_infinity_plist_cmd);
+ install_element(CONFIG_NODE, &no_ipv6_pim_spt_switchover_infinity_cmd);
+ install_element(CONFIG_NODE, &no_ipv6_pim_spt_switchover_infinity_plist_cmd);
+ install_element(CONFIG_NODE, &ipv6_pim_packets_cmd);
+ install_element(CONFIG_NODE, &no_ipv6_pim_packets_cmd);
+ install_element(CONFIG_NODE, &ipv6_pim_keep_alive_cmd);
+ install_element(CONFIG_NODE, &no_ipv6_pim_keep_alive_cmd);
+ install_element(CONFIG_NODE, &ipv6_pim_rp_keep_alive_cmd);
+ install_element(CONFIG_NODE, &no_ipv6_pim_rp_keep_alive_cmd);
+ install_element(CONFIG_NODE, &ipv6_pim_register_suppress_cmd);
+ install_element(CONFIG_NODE, &no_ipv6_pim_register_suppress_cmd);
+}
diff --git a/pimd/pim6_cmd.h b/pimd/pim6_cmd.h
new file mode 100644
index 0000000000..e49045a1b5
--- /dev/null
+++ b/pimd/pim6_cmd.h
@@ -0,0 +1,44 @@
+/*
+ * PIM for IPv6 FRR
+ * Copyright (C) 2022 Vmware, Inc.
+ * Mobashshera Rasool <mrasool@vmware.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 PIM6_CMD_H
+#define PIM6_CMD_H
+
+#define PIM_STR "PIM information\n"
+#define MLD_STR "MLD information\n"
+#define MLD_GROUP_STR "MLD groups information\n"
+#define MLD_SOURCE_STR "MLD sources information\n"
+#define IFACE_MLD_STR "Enable MLD operation\n"
+#define IFACE_MLD_QUERY_INTERVAL_STR "MLD host query interval\n"
+#define IFACE_MLD_QUERY_MAX_RESPONSE_TIME_STR \
+ "MLD max query response value (seconds)\n"
+#define IFACE_MLD_QUERY_MAX_RESPONSE_TIME_DSEC_STR \
+ "MLD max query response value (deciseconds)\n"
+#define IFACE_MLD_LAST_MEMBER_QUERY_INTERVAL_STR \
+ "MLD last member query interval\n"
+#define IFACE_MLD_LAST_MEMBER_QUERY_COUNT_STR "MLD last member query count\n"
+#define MROUTE_STR "IP multicast routing table\n"
+#define DEBUG_MLD_STR "MLD protocol activity\n"
+#define DEBUG_MLD_EVENTS_STR "MLD protocol events\n"
+#define DEBUG_MLD_PACKETS_STR "MLD protocol packets\n"
+#define DEBUG_MLD_TRACE_STR "MLD internal daemon activity\n"
+
+void pim_cmd_init(void);
+
+#endif /* PIM6_CMD_H */
diff --git a/pimd/pim6_main.c b/pimd/pim6_main.c
index a6cfe7682c..c9e3463969 100644
--- a/pimd/pim6_main.c
+++ b/pimd/pim6_main.c
@@ -36,6 +36,8 @@
#include "pim_errors.h"
#include "pim_iface.h"
#include "pim_zebra.h"
+#include "pim_nb.h"
+#include "pim6_cmd.h"
zebra_capabilities_t _caps_p[] = {
ZCAP_SYS_ADMIN,
@@ -109,6 +111,9 @@ static const struct frr_yang_module_info *const pim6d_yang_modules[] = {
&frr_route_map_info,
&frr_vrf_info,
&frr_routing_info,
+ &frr_pim_info,
+ &frr_pim_rp_info,
+ &frr_gmp_info,
};
/* clang-format off */
@@ -172,9 +177,9 @@ int main(int argc, char **argv, char **envp)
prefix_list_delete_hook(pim_prefix_list_update);
pim_route_map_init();
- pim_init();
#endif
-
+ /* pim_init(); */
+ pim_cmd_init();
/*
* Initialize zclient "update" and "lookup" sockets
*/
diff --git a/pimd/pim6_stubs.c b/pimd/pim6_stubs.c
index 038baa0692..9f68b7be3d 100644
--- a/pimd/pim6_stubs.c
+++ b/pimd/pim6_stubs.c
@@ -133,9 +133,3 @@ void pim_reg_del_on_couldreg_fail(struct interface *ifp)
{
}
-/*
- * CLI
- */
-void pim_cmd_init(void)
-{
-}
diff --git a/pimd/pim_addr.h b/pimd/pim_addr.h
index 1351fca225..a278a46593 100644
--- a/pimd/pim_addr.h
+++ b/pimd/pim_addr.h
@@ -32,6 +32,8 @@ typedef struct in_addr pim_addr;
#define PIM_AF AF_INET
#define PIM_AFI AFI_IP
#define PIM_MAX_BITLEN IPV4_MAX_BITLEN
+#define PIM_AF_NAME "ip"
+#define FRR_PIM_AF_XPATH_VAL "frr-routing:ipv4"
union pimprefixptr {
prefixtype(pimprefixptr, struct prefix, p)
@@ -50,6 +52,8 @@ typedef struct in6_addr pim_addr;
#define PIM_AF AF_INET6
#define PIM_AFI AFI_IP6
#define PIM_MAX_BITLEN IPV6_MAX_BITLEN
+#define PIM_AF_NAME "ipv6"
+#define FRR_PIM_AF_XPATH_VAL "frr-routing:ipv6"
union pimprefixptr {
prefixtype(pimprefixptr, struct prefix, p)
diff --git a/pimd/pim_bfd.c b/pimd/pim_bfd.c
index c2fe525b2d..c1f8220db6 100644
--- a/pimd/pim_bfd.c
+++ b/pimd/pim_bfd.c
@@ -50,15 +50,15 @@ void pim_bfd_write_config(struct vty *vty, struct interface *ifp)
if (pim_ifp->bfd_config.detection_multiplier != BFD_DEF_DETECT_MULT
|| pim_ifp->bfd_config.min_rx != BFD_DEF_MIN_RX
|| pim_ifp->bfd_config.min_tx != BFD_DEF_MIN_TX)
- vty_out(vty, " ip pim bfd %d %d %d\n",
+ vty_out(vty, " " PIM_AF_NAME " pim bfd %d %d %d\n",
pim_ifp->bfd_config.detection_multiplier,
pim_ifp->bfd_config.min_rx, pim_ifp->bfd_config.min_tx);
else
#endif /* ! HAVE_BFDD */
- vty_out(vty, " ip pim bfd\n");
+ vty_out(vty, " " PIM_AF_NAME " pim bfd\n");
if (pim_ifp->bfd_config.profile)
- vty_out(vty, " ip pim bfd profile %s\n",
+ vty_out(vty, " " PIM_AF_NAME " pim bfd profile %s\n",
pim_ifp->bfd_config.profile);
}
diff --git a/pimd/pim_bsm.c b/pimd/pim_bsm.c
index 8d65901b57..4d1e700ab0 100644
--- a/pimd/pim_bsm.c
+++ b/pimd/pim_bsm.c
@@ -59,9 +59,9 @@ void pim_bsm_write_config(struct vty *vty, struct interface *ifp)
if (pim_ifp) {
if (!pim_ifp->bsm_enable)
- vty_out(vty, " no ip pim bsm\n");
+ vty_out(vty, " no " PIM_AF_NAME " pim bsm\n");
if (!pim_ifp->ucast_bsm_accept)
- vty_out(vty, " no ip pim unicast-bsm\n");
+ vty_out(vty, " no " PIM_AF_NAME " pim unicast-bsm\n");
}
}
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 3e3074827f..76f90cdba7 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -67,6 +67,7 @@
#include "lib/northbound_cli.h"
#include "pim_errors.h"
#include "pim_nb.h"
+#include "pim_cmd_common.h"
#ifndef VTYSH_EXTRACT_PL
#include "pimd/pim_cmd_clippy.c"
@@ -3761,32 +3762,6 @@ static void clear_interfaces(struct pim_instance *pim)
}
/**
- * Get current node VRF name.
- *
- * NOTE:
- * In case of failure it will print error message to user.
- *
- * \returns name or NULL if failed to get VRF.
- */
-static const char *pim_cli_get_vrf_name(struct vty *vty)
-{
- const struct lyd_node *vrf_node;
-
- /* Not inside any VRF context. */
- if (vty->xpath_index == 0)
- return VRF_DEFAULT_NAME;
-
- vrf_node = yang_dnode_get(vty->candidate_config->dnode, VTY_CURR_XPATH);
- if (vrf_node == NULL) {
- vty_out(vty, "%% Failed to get vrf dnode in configuration\n");
- return NULL;
- }
-
- return yang_dnode_get_string(vrf_node, "./name");
-}
-
-#if PIM_IPV != 6
-/**
* Compatibility function to keep the legacy mesh group CLI behavior:
* Delete group when there are no more configurations in it.
*
@@ -3833,7 +3808,6 @@ static void pim_cli_legacy_mesh_group_behavior(struct vty *vty,
/* No configurations found: delete it. */
nb_cli_enqueue_change(vty, xpath_value, NB_OP_DESTROY, NULL);
}
-#endif /* PIM_IPV != 6 */
DEFUN (clear_ip_interfaces,
clear_ip_interfaces_cmd,
@@ -6750,38 +6724,12 @@ DEFUN (ip_pim_spt_switchover_infinity,
"SPT-Switchover\n"
"Never switch to SPT Tree\n")
{
- const char *vrfname;
- char spt_plist_xpath[XPATH_MAXLEN];
- char spt_action_xpath[XPATH_MAXLEN];
-
- vrfname = pim_cli_get_vrf_name(vty);
- if (vrfname == NULL)
- return CMD_WARNING_CONFIG_FAILED;
-
- snprintf(spt_plist_xpath, sizeof(spt_plist_xpath),
- FRR_PIM_VRF_XPATH, "frr-pim:pimd", "pim", vrfname,
- "frr-routing:ipv4");
- strlcat(spt_plist_xpath, "/spt-switchover/spt-infinity-prefix-list",
- sizeof(spt_plist_xpath));
-
- snprintf(spt_action_xpath, sizeof(spt_action_xpath),
- FRR_PIM_VRF_XPATH, "frr-pim:pimd", "pim", vrfname,
- "frr-routing:ipv4");
- strlcat(spt_action_xpath, "/spt-switchover/spt-action",
- sizeof(spt_action_xpath));
-
- if (yang_dnode_exists(vty->candidate_config->dnode, spt_plist_xpath))
- nb_cli_enqueue_change(vty, spt_plist_xpath, NB_OP_DESTROY,
- NULL);
- nb_cli_enqueue_change(vty, spt_action_xpath, NB_OP_MODIFY,
- "PIM_SPT_INFINITY");
-
- return nb_cli_apply_changes(vty, NULL);
+ return pim_process_spt_switchover_infinity_cmd(vty);
}
-DEFUN (ip_pim_spt_switchover_infinity_plist,
+DEFPY (ip_pim_spt_switchover_infinity_plist,
ip_pim_spt_switchover_infinity_plist_cmd,
- "ip pim spt-switchover infinity-and-beyond prefix-list WORD",
+ "ip pim spt-switchover infinity-and-beyond prefix-list WORD$plist",
IP_STR
PIM_STR
"SPT-Switchover\n"
@@ -6789,32 +6737,7 @@ DEFUN (ip_pim_spt_switchover_infinity_plist,
"Prefix-List to control which groups to switch\n"
"Prefix-List name\n")
{
- const char *vrfname;
- char spt_plist_xpath[XPATH_MAXLEN];
- char spt_action_xpath[XPATH_MAXLEN];
-
- vrfname = pim_cli_get_vrf_name(vty);
- if (vrfname == NULL)
- return CMD_WARNING_CONFIG_FAILED;
-
- snprintf(spt_plist_xpath, sizeof(spt_plist_xpath),
- FRR_PIM_VRF_XPATH, "frr-pim:pimd", "pim", vrfname,
- "frr-routing:ipv4");
- strlcat(spt_plist_xpath, "/spt-switchover/spt-infinity-prefix-list",
- sizeof(spt_plist_xpath));
-
- snprintf(spt_action_xpath, sizeof(spt_action_xpath),
- FRR_PIM_VRF_XPATH, "frr-pim:pimd", "pim", vrfname,
- "frr-routing:ipv4");
- strlcat(spt_action_xpath, "/spt-switchover/spt-action",
- sizeof(spt_action_xpath));
-
- nb_cli_enqueue_change(vty, spt_action_xpath, NB_OP_MODIFY,
- "PIM_SPT_INFINITY");
- nb_cli_enqueue_change(vty, spt_plist_xpath, NB_OP_MODIFY,
- argv[5]->arg);
-
- return nb_cli_apply_changes(vty, NULL);
+ return pim_process_spt_switchover_prefixlist_cmd(vty, plist);
}
DEFUN (no_ip_pim_spt_switchover_infinity,
@@ -6826,31 +6749,7 @@ DEFUN (no_ip_pim_spt_switchover_infinity,
"SPT_Switchover\n"
"Never switch to SPT Tree\n")
{
- const char *vrfname;
- char spt_plist_xpath[XPATH_MAXLEN];
- char spt_action_xpath[XPATH_MAXLEN];
-
- vrfname = pim_cli_get_vrf_name(vty);
- if (vrfname == NULL)
- return CMD_WARNING_CONFIG_FAILED;
-
- snprintf(spt_plist_xpath, sizeof(spt_plist_xpath),
- FRR_PIM_VRF_XPATH, "frr-pim:pimd", "pim", vrfname,
- "frr-routing:ipv4");
- strlcat(spt_plist_xpath, "/spt-switchover/spt-infinity-prefix-list",
- sizeof(spt_plist_xpath));
-
- snprintf(spt_action_xpath, sizeof(spt_action_xpath),
- FRR_PIM_VRF_XPATH, "frr-pim:pimd", "pim", vrfname,
- "frr-routing:ipv4");
- strlcat(spt_action_xpath, "/spt-switchover/spt-action",
- sizeof(spt_action_xpath));
-
- nb_cli_enqueue_change(vty, spt_plist_xpath, NB_OP_DESTROY, NULL);
- nb_cli_enqueue_change(vty, spt_action_xpath, NB_OP_MODIFY,
- "PIM_SPT_IMMEDIATE");
-
- return nb_cli_apply_changes(vty, NULL);
+ return pim_process_no_spt_switchover_cmd(vty);
}
DEFUN (no_ip_pim_spt_switchover_infinity_plist,
@@ -6864,31 +6763,7 @@ DEFUN (no_ip_pim_spt_switchover_infinity_plist,
"Prefix-List to control which groups to switch\n"
"Prefix-List name\n")
{
- const char *vrfname;
- char spt_plist_xpath[XPATH_MAXLEN];
- char spt_action_xpath[XPATH_MAXLEN];
-
- vrfname = pim_cli_get_vrf_name(vty);
- if (vrfname == NULL)
- return CMD_WARNING_CONFIG_FAILED;
-
- snprintf(spt_plist_xpath, sizeof(spt_plist_xpath),
- FRR_PIM_VRF_XPATH, "frr-pim:pimd", "pim", vrfname,
- "frr-routing:ipv4");
- strlcat(spt_plist_xpath, "/spt-switchover/spt-infinity-prefix-list",
- sizeof(spt_plist_xpath));
-
- snprintf(spt_action_xpath, sizeof(spt_action_xpath),
- FRR_PIM_VRF_XPATH, "frr-pim:pimd", "pim", vrfname,
- "frr-routing:ipv4");
- strlcat(spt_action_xpath, "/spt-switchover/spt-action",
- sizeof(spt_action_xpath));
-
- nb_cli_enqueue_change(vty, spt_plist_xpath, NB_OP_DESTROY, NULL);
- nb_cli_enqueue_change(vty, spt_action_xpath, NB_OP_MODIFY,
- "PIM_SPT_IMMEDIATE");
-
- return nb_cli_apply_changes(vty, NULL);
+ return pim_process_no_spt_switchover_cmd(vty);
}
DEFPY (pim_register_accept_list,
@@ -6923,23 +6798,15 @@ DEFPY (pim_register_accept_list,
return nb_cli_apply_changes(vty, NULL);
}
-DEFUN (ip_pim_joinprune_time,
+DEFPY (ip_pim_joinprune_time,
ip_pim_joinprune_time_cmd,
- "ip pim join-prune-interval (1-65535)",
+ "ip pim join-prune-interval (1-65535)$jpi",
IP_STR
"pim multicast routing\n"
"Join Prune Send Interval\n"
"Seconds\n")
{
- char xpath[XPATH_MAXLEN];
-
- snprintf(xpath, sizeof(xpath), FRR_PIM_ROUTER_XPATH,
- "frr-routing:ipv4");
- strlcat(xpath, "/join-prune-interval", sizeof(xpath));
-
- nb_cli_enqueue_change(vty, xpath, NB_OP_MODIFY, argv[3]->arg);
-
- return nb_cli_apply_changes(vty, NULL);
+ return pim_process_join_prune_cmd(vty, jpi_str);
}
DEFUN (no_ip_pim_joinprune_time,
@@ -6951,34 +6818,18 @@ DEFUN (no_ip_pim_joinprune_time,
"Join Prune Send Interval\n"
IGNORED_IN_NO_STR)
{
- char xpath[XPATH_MAXLEN];
-
- snprintf(xpath, sizeof(xpath), FRR_PIM_ROUTER_XPATH,
- "frr-routing:ipv4");
- strlcat(xpath, "/join-prune-interval", sizeof(xpath));
-
- nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
-
- return nb_cli_apply_changes(vty, NULL);
+ return pim_process_no_join_prune_cmd(vty);
}
-DEFUN (ip_pim_register_suppress,
+DEFPY (ip_pim_register_suppress,
ip_pim_register_suppress_cmd,
- "ip pim register-suppress-time (1-65535)",
+ "ip pim register-suppress-time (1-65535)$rst",
IP_STR
"pim multicast routing\n"
"Register Suppress Timer\n"
"Seconds\n")
{
- char xpath[XPATH_MAXLEN];
-
- snprintf(xpath, sizeof(xpath), FRR_PIM_ROUTER_XPATH,
- "frr-routing:ipv4");
- strlcat(xpath, "/register-suppress-time", sizeof(xpath));
-
- nb_cli_enqueue_change(vty, xpath, NB_OP_MODIFY, argv[3]->arg);
-
- return nb_cli_apply_changes(vty, NULL);
+ return pim_process_register_suppress_cmd(vty, rst_str);
}
DEFUN (no_ip_pim_register_suppress,
@@ -6990,43 +6841,19 @@ DEFUN (no_ip_pim_register_suppress,
"Register Suppress Timer\n"
IGNORED_IN_NO_STR)
{
- char xpath[XPATH_MAXLEN];
-
- snprintf(xpath, sizeof(xpath), FRR_PIM_ROUTER_XPATH,
- "frr-routing:ipv4");
- strlcat(xpath, "/register-suppress-time", sizeof(xpath));
-
- nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
-
- return nb_cli_apply_changes(vty, NULL);
+ return pim_process_no_register_suppress_cmd(vty);
}
-DEFUN (ip_pim_rp_keep_alive,
+DEFPY (ip_pim_rp_keep_alive,
ip_pim_rp_keep_alive_cmd,
- "ip pim rp keep-alive-timer (1-65535)",
+ "ip pim rp keep-alive-timer (1-65535)$kat",
IP_STR
"pim multicast routing\n"
"Rendevous Point\n"
"Keep alive Timer\n"
"Seconds\n")
{
- const char *vrfname;
- char rp_ka_timer_xpath[XPATH_MAXLEN];
-
- vrfname = pim_cli_get_vrf_name(vty);
- if (vrfname == NULL)
- return CMD_WARNING_CONFIG_FAILED;
-
- snprintf(rp_ka_timer_xpath, sizeof(rp_ka_timer_xpath),
- FRR_PIM_VRF_XPATH, "frr-pim:pimd", "pim", vrfname,
- "frr-routing:ipv4");
- strlcat(rp_ka_timer_xpath, "/rp-keep-alive-timer",
- sizeof(rp_ka_timer_xpath));
-
- nb_cli_enqueue_change(vty, rp_ka_timer_xpath, NB_OP_MODIFY,
- argv[4]->arg);
-
- return nb_cli_apply_changes(vty, NULL);
+ return pim_process_rp_kat_cmd(vty, kat_str);
}
DEFUN (no_ip_pim_rp_keep_alive,
@@ -7039,64 +6866,18 @@ DEFUN (no_ip_pim_rp_keep_alive,
"Keep alive Timer\n"
IGNORED_IN_NO_STR)
{
- const char *vrfname;
- char rp_ka_timer[6];
- char rp_ka_timer_xpath[XPATH_MAXLEN];
- uint v;
- char rs_timer_xpath[XPATH_MAXLEN];
-
- snprintf(rs_timer_xpath, sizeof(rs_timer_xpath),
- FRR_PIM_ROUTER_XPATH, "frr-routing:ipv4");
- strlcat(rs_timer_xpath, "/register-suppress-time",
- sizeof(rs_timer_xpath));
-
- /* RFC4601 */
- v = yang_dnode_get_uint16(vty->candidate_config->dnode,
- rs_timer_xpath);
- v = 3 * v + PIM_REGISTER_PROBE_TIME_DEFAULT;
- if (v > UINT16_MAX)
- v = UINT16_MAX;
- snprintf(rp_ka_timer, sizeof(rp_ka_timer), "%u", v);
-
- vrfname = pim_cli_get_vrf_name(vty);
- if (vrfname == NULL)
- return CMD_WARNING_CONFIG_FAILED;
-
- snprintf(rp_ka_timer_xpath, sizeof(rp_ka_timer_xpath),
- FRR_PIM_VRF_XPATH, "frr-pim:pimd", "pim", vrfname,
- "frr-routing:ipv4");
- strlcat(rp_ka_timer_xpath, "/rp-keep-alive-timer",
- sizeof(rp_ka_timer_xpath));
-
- nb_cli_enqueue_change(vty, rp_ka_timer_xpath, NB_OP_MODIFY,
- rp_ka_timer);
-
- return nb_cli_apply_changes(vty, NULL);
+ return pim_process_no_rp_kat_cmd(vty);
}
-DEFUN (ip_pim_keep_alive,
+DEFPY (ip_pim_keep_alive,
ip_pim_keep_alive_cmd,
- "ip pim keep-alive-timer (1-65535)",
+ "ip pim keep-alive-timer (1-65535)$kat",
IP_STR
"pim multicast routing\n"
"Keep alive Timer\n"
"Seconds\n")
{
- const char *vrfname;
- char ka_timer_xpath[XPATH_MAXLEN];
-
- vrfname = pim_cli_get_vrf_name(vty);
- if (vrfname == NULL)
- return CMD_WARNING_CONFIG_FAILED;
-
- snprintf(ka_timer_xpath, sizeof(ka_timer_xpath), FRR_PIM_VRF_XPATH,
- "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4");
- strlcat(ka_timer_xpath, "/keep-alive-timer", sizeof(ka_timer_xpath));
-
- nb_cli_enqueue_change(vty, ka_timer_xpath, NB_OP_MODIFY,
- argv[3]->arg);
-
- return nb_cli_apply_changes(vty, NULL);
+ return pim_process_keepalivetimer_cmd(vty, kat_str);
}
DEFUN (no_ip_pim_keep_alive,
@@ -7108,23 +6889,10 @@ DEFUN (no_ip_pim_keep_alive,
"Keep alive Timer\n"
IGNORED_IN_NO_STR)
{
- const char *vrfname;
- char ka_timer_xpath[XPATH_MAXLEN];
-
- vrfname = pim_cli_get_vrf_name(vty);
- if (vrfname == NULL)
- return CMD_WARNING_CONFIG_FAILED;
-
- snprintf(ka_timer_xpath, sizeof(ka_timer_xpath), FRR_PIM_VRF_XPATH,
- "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4");
- strlcat(ka_timer_xpath, "/keep-alive-timer", sizeof(ka_timer_xpath));
-
- nb_cli_enqueue_change(vty, ka_timer_xpath, NB_OP_DESTROY, NULL);
-
- return nb_cli_apply_changes(vty, NULL);
+ return pim_process_no_keepalivetimer_cmd(vty);
}
-DEFUN (ip_pim_packets,
+DEFPY (ip_pim_packets,
ip_pim_packets_cmd,
"ip pim packets (1-255)",
IP_STR
@@ -7132,15 +6900,7 @@ DEFUN (ip_pim_packets,
"packets to process at one time per fd\n"
"Number of packets\n")
{
- char xpath[XPATH_MAXLEN];
-
- snprintf(xpath, sizeof(xpath), FRR_PIM_ROUTER_XPATH,
- "frr-routing:ipv4");
- strlcat(xpath, "/packets", sizeof(xpath));
-
- nb_cli_enqueue_change(vty, xpath, NB_OP_MODIFY, argv[3]->arg);
-
- return nb_cli_apply_changes(vty, NULL);
+ return pim_process_pim_packet_cmd(vty, packets_str);
}
DEFUN (no_ip_pim_packets,
@@ -7152,15 +6912,7 @@ DEFUN (no_ip_pim_packets,
"packets to process at one time per fd\n"
IGNORED_IN_NO_STR)
{
- char xpath[XPATH_MAXLEN];
-
- snprintf(xpath, sizeof(xpath), FRR_PIM_ROUTER_XPATH,
- "frr-routing:ipv4");
- strlcat(xpath, "/packets", sizeof(xpath));
-
- nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
-
- return nb_cli_apply_changes(vty, NULL);
+ return pim_process_no_pim_packet_cmd(vty);
}
DEFPY (igmp_group_watermark,
@@ -9543,7 +9295,6 @@ ALIAS(no_ip_pim_bfd, no_ip_pim_bfd_param_cmd,
"Desired min transmit interval\n")
#endif /* !HAVE_BFDD */
-#if PIM_IPV != 6
DEFPY(ip_msdp_peer, ip_msdp_peer_cmd,
"ip msdp peer A.B.C.D$peer source A.B.C.D$source",
IP_STR
@@ -10571,7 +10322,6 @@ DEFUN (show_ip_msdp_sa_sg_vrf_all,
return CMD_SUCCESS;
}
-#endif /* PIM_IPV != 6 */
struct pim_sg_cache_walk_data {
struct vty *vty;
@@ -11005,12 +10755,10 @@ void pim_cmd_init(void)
install_element(VRF_NODE, &ip_ssmpingd_cmd);
install_element(CONFIG_NODE, &no_ip_ssmpingd_cmd);
install_element(VRF_NODE, &no_ip_ssmpingd_cmd);
-#if PIM_IPV != 6
install_element(CONFIG_NODE, &ip_msdp_peer_cmd);
install_element(VRF_NODE, &ip_msdp_peer_cmd);
install_element(CONFIG_NODE, &no_ip_msdp_peer_cmd);
install_element(VRF_NODE, &no_ip_msdp_peer_cmd);
-#endif /* PIM_IPV != 6 */
install_element(CONFIG_NODE, &ip_pim_ecmp_cmd);
install_element(VRF_NODE, &ip_pim_ecmp_cmd);
install_element(CONFIG_NODE, &no_ip_pim_ecmp_cmd);
@@ -11179,14 +10927,12 @@ void pim_cmd_init(void)
install_element(ENABLE_NODE, &no_debug_pim_mlag_cmd);
install_element(ENABLE_NODE, &debug_pim_vxlan_cmd);
install_element(ENABLE_NODE, &no_debug_pim_vxlan_cmd);
-#if PIM_IPV != 6
install_element(ENABLE_NODE, &debug_msdp_cmd);
install_element(ENABLE_NODE, &no_debug_msdp_cmd);
install_element(ENABLE_NODE, &debug_msdp_events_cmd);
install_element(ENABLE_NODE, &no_debug_msdp_events_cmd);
install_element(ENABLE_NODE, &debug_msdp_packets_cmd);
install_element(ENABLE_NODE, &no_debug_msdp_packets_cmd);
-#endif /* PIM_IPV != 6 */
install_element(ENABLE_NODE, &debug_mtrace_cmd);
install_element(ENABLE_NODE, &no_debug_mtrace_cmd);
install_element(ENABLE_NODE, &debug_bsm_cmd);
@@ -11232,20 +10978,17 @@ void pim_cmd_init(void)
install_element(CONFIG_NODE, &no_debug_pim_mlag_cmd);
install_element(CONFIG_NODE, &debug_pim_vxlan_cmd);
install_element(CONFIG_NODE, &no_debug_pim_vxlan_cmd);
-#if PIM_IPV != 6
install_element(CONFIG_NODE, &debug_msdp_cmd);
install_element(CONFIG_NODE, &no_debug_msdp_cmd);
install_element(CONFIG_NODE, &debug_msdp_events_cmd);
install_element(CONFIG_NODE, &no_debug_msdp_events_cmd);
install_element(CONFIG_NODE, &debug_msdp_packets_cmd);
install_element(CONFIG_NODE, &no_debug_msdp_packets_cmd);
-#endif /* PIM_IPV != 6 */
install_element(CONFIG_NODE, &debug_mtrace_cmd);
install_element(CONFIG_NODE, &no_debug_mtrace_cmd);
install_element(CONFIG_NODE, &debug_bsm_cmd);
install_element(CONFIG_NODE, &no_debug_bsm_cmd);
-#if PIM_IPV != 6
install_element(CONFIG_NODE, &ip_msdp_timers_cmd);
install_element(VRF_NODE, &ip_msdp_timers_cmd);
install_element(CONFIG_NODE, &no_ip_msdp_timers_cmd);
@@ -11268,7 +11011,6 @@ void pim_cmd_init(void)
install_element(VIEW_NODE, &show_ip_msdp_sa_sg_vrf_all_cmd);
install_element(VIEW_NODE, &show_ip_msdp_mesh_group_cmd);
install_element(VIEW_NODE, &show_ip_msdp_mesh_group_vrf_all_cmd);
-#endif /* PIM_IPV != 6 */
install_element(VIEW_NODE, &show_ip_pim_ssm_range_cmd);
install_element(VIEW_NODE, &show_ip_pim_group_type_cmd);
install_element(VIEW_NODE, &show_ip_pim_vxlan_sg_cmd);
diff --git a/pimd/pim_cmd_common.c b/pimd/pim_cmd_common.c
new file mode 100644
index 0000000000..6adea54a61
--- /dev/null
+++ b/pimd/pim_cmd_common.c
@@ -0,0 +1,328 @@
+/*
+ * PIM for IPv6 FRR
+ * Copyright (C) 2022 Vmware, Inc.
+ * Mobashshera Rasool <mrasool@vmware.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
+ */
+
+#include <zebra.h>
+
+#include "lib/json.h"
+#include "command.h"
+#include "if.h"
+#include "prefix.h"
+#include "zclient.h"
+#include "plist.h"
+#include "hash.h"
+#include "nexthop.h"
+#include "vrf.h"
+#include "ferr.h"
+
+#include "pimd.h"
+#include "pim_vty.h"
+#include "lib/northbound_cli.h"
+#include "pim_errors.h"
+#include "pim_nb.h"
+#include "pim_cmd_common.h"
+
+/**
+ * Get current node VRF name.
+ *
+ * NOTE:
+ * In case of failure it will print error message to user.
+ *
+ * \returns name or NULL if failed to get VRF.
+ */
+const char *pim_cli_get_vrf_name(struct vty *vty)
+{
+ const struct lyd_node *vrf_node;
+
+ /* Not inside any VRF context. */
+ if (vty->xpath_index == 0)
+ return VRF_DEFAULT_NAME;
+
+ vrf_node = yang_dnode_get(vty->candidate_config->dnode, VTY_CURR_XPATH);
+ if (vrf_node == NULL) {
+ vty_out(vty, "%% Failed to get vrf dnode in configuration\n");
+ return NULL;
+ }
+
+ return yang_dnode_get_string(vrf_node, "./name");
+}
+
+int pim_process_join_prune_cmd(struct vty *vty, const char *jpi_str)
+{
+ char xpath[XPATH_MAXLEN];
+
+ snprintf(xpath, sizeof(xpath), FRR_PIM_ROUTER_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+ strlcat(xpath, "/join-prune-interval", sizeof(xpath));
+
+ nb_cli_enqueue_change(vty, xpath, NB_OP_MODIFY, jpi_str);
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+int pim_process_no_join_prune_cmd(struct vty *vty)
+{
+ char xpath[XPATH_MAXLEN];
+
+ snprintf(xpath, sizeof(xpath), FRR_PIM_ROUTER_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+ strlcat(xpath, "/join-prune-interval", sizeof(xpath));
+
+ nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+int pim_process_spt_switchover_infinity_cmd(struct vty *vty)
+{
+ const char *vrfname;
+ char spt_plist_xpath[XPATH_MAXLEN];
+ char spt_action_xpath[XPATH_MAXLEN];
+
+ vrfname = pim_cli_get_vrf_name(vty);
+ if (vrfname == NULL)
+ return CMD_WARNING_CONFIG_FAILED;
+
+ snprintf(spt_plist_xpath, sizeof(spt_plist_xpath),
+ FRR_PIM_VRF_XPATH, "frr-pim:pimd", "pim", vrfname,
+ FRR_PIM_AF_XPATH_VAL);
+ strlcat(spt_plist_xpath, "/spt-switchover/spt-infinity-prefix-list",
+ sizeof(spt_plist_xpath));
+
+ snprintf(spt_action_xpath, sizeof(spt_action_xpath),
+ FRR_PIM_VRF_XPATH, "frr-pim:pimd", "pim", vrfname,
+ FRR_PIM_AF_XPATH_VAL);
+ strlcat(spt_action_xpath, "/spt-switchover/spt-action",
+ sizeof(spt_action_xpath));
+
+ if (yang_dnode_exists(vty->candidate_config->dnode, spt_plist_xpath))
+ nb_cli_enqueue_change(vty, spt_plist_xpath, NB_OP_DESTROY,
+ NULL);
+ nb_cli_enqueue_change(vty, spt_action_xpath, NB_OP_MODIFY,
+ "PIM_SPT_INFINITY");
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+int pim_process_spt_switchover_prefixlist_cmd(struct vty *vty,
+ const char *plist)
+{
+ const char *vrfname;
+ char spt_plist_xpath[XPATH_MAXLEN];
+ char spt_action_xpath[XPATH_MAXLEN];
+
+ vrfname = pim_cli_get_vrf_name(vty);
+ if (vrfname == NULL)
+ return CMD_WARNING_CONFIG_FAILED;
+
+ snprintf(spt_plist_xpath, sizeof(spt_plist_xpath),
+ FRR_PIM_VRF_XPATH, "frr-pim:pimd", "pim", vrfname,
+ FRR_PIM_AF_XPATH_VAL);
+ strlcat(spt_plist_xpath, "/spt-switchover/spt-infinity-prefix-list",
+ sizeof(spt_plist_xpath));
+
+ snprintf(spt_action_xpath, sizeof(spt_action_xpath),
+ FRR_PIM_VRF_XPATH, "frr-pim:pimd", "pim", vrfname,
+ FRR_PIM_AF_XPATH_VAL);
+ strlcat(spt_action_xpath, "/spt-switchover/spt-action",
+ sizeof(spt_action_xpath));
+
+ nb_cli_enqueue_change(vty, spt_action_xpath, NB_OP_MODIFY,
+ "PIM_SPT_INFINITY");
+ nb_cli_enqueue_change(vty, spt_plist_xpath, NB_OP_MODIFY,
+ plist);
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+int pim_process_no_spt_switchover_cmd(struct vty *vty)
+{
+ const char *vrfname;
+ char spt_plist_xpath[XPATH_MAXLEN];
+ char spt_action_xpath[XPATH_MAXLEN];
+
+ vrfname = pim_cli_get_vrf_name(vty);
+ if (vrfname == NULL)
+ return CMD_WARNING_CONFIG_FAILED;
+
+ snprintf(spt_plist_xpath, sizeof(spt_plist_xpath),
+ FRR_PIM_VRF_XPATH, "frr-pim:pimd", "pim", vrfname,
+ FRR_PIM_AF_XPATH_VAL);
+ strlcat(spt_plist_xpath, "/spt-switchover/spt-infinity-prefix-list",
+ sizeof(spt_plist_xpath));
+
+ snprintf(spt_action_xpath, sizeof(spt_action_xpath),
+ FRR_PIM_VRF_XPATH, "frr-pim:pimd", "pim", vrfname,
+ FRR_PIM_AF_XPATH_VAL);
+ strlcat(spt_action_xpath, "/spt-switchover/spt-action",
+ sizeof(spt_action_xpath));
+
+ nb_cli_enqueue_change(vty, spt_plist_xpath, NB_OP_DESTROY, NULL);
+ nb_cli_enqueue_change(vty, spt_action_xpath, NB_OP_MODIFY,
+ "PIM_SPT_IMMEDIATE");
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+int pim_process_pim_packet_cmd(struct vty *vty, const char *packet)
+{
+ char xpath[XPATH_MAXLEN];
+
+ snprintf(xpath, sizeof(xpath), FRR_PIM_ROUTER_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+ strlcat(xpath, "/packets", sizeof(xpath));
+
+ nb_cli_enqueue_change(vty, xpath, NB_OP_MODIFY, packet);
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+int pim_process_no_pim_packet_cmd(struct vty *vty)
+{
+ char xpath[XPATH_MAXLEN];
+
+ snprintf(xpath, sizeof(xpath), FRR_PIM_ROUTER_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+ strlcat(xpath, "/packets", sizeof(xpath));
+
+ nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+int pim_process_keepalivetimer_cmd(struct vty *vty, const char *kat)
+{
+ const char *vrfname;
+ char ka_timer_xpath[XPATH_MAXLEN];
+
+ vrfname = pim_cli_get_vrf_name(vty);
+ if (vrfname == NULL)
+ return CMD_WARNING_CONFIG_FAILED;
+
+ snprintf(ka_timer_xpath, sizeof(ka_timer_xpath), FRR_PIM_VRF_XPATH,
+ "frr-pim:pimd", "pim", vrfname, FRR_PIM_AF_XPATH_VAL);
+ strlcat(ka_timer_xpath, "/keep-alive-timer", sizeof(ka_timer_xpath));
+
+ nb_cli_enqueue_change(vty, ka_timer_xpath, NB_OP_MODIFY,
+ kat);
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+int pim_process_no_keepalivetimer_cmd(struct vty *vty)
+{
+ const char *vrfname;
+ char ka_timer_xpath[XPATH_MAXLEN];
+
+ vrfname = pim_cli_get_vrf_name(vty);
+ if (vrfname == NULL)
+ return CMD_WARNING_CONFIG_FAILED;
+
+ snprintf(ka_timer_xpath, sizeof(ka_timer_xpath), FRR_PIM_VRF_XPATH,
+ "frr-pim:pimd", "pim", vrfname, FRR_PIM_AF_XPATH_VAL);
+ strlcat(ka_timer_xpath, "/keep-alive-timer", sizeof(ka_timer_xpath));
+
+ nb_cli_enqueue_change(vty, ka_timer_xpath, NB_OP_DESTROY, NULL);
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+int pim_process_rp_kat_cmd(struct vty *vty, const char *rpkat)
+{
+ const char *vrfname;
+ char rp_ka_timer_xpath[XPATH_MAXLEN];
+
+ vrfname = pim_cli_get_vrf_name(vty);
+ if (vrfname == NULL)
+ return CMD_WARNING_CONFIG_FAILED;
+
+ snprintf(rp_ka_timer_xpath, sizeof(rp_ka_timer_xpath),
+ FRR_PIM_VRF_XPATH, "frr-pim:pimd", "pim", vrfname,
+ FRR_PIM_AF_XPATH_VAL);
+ strlcat(rp_ka_timer_xpath, "/rp-keep-alive-timer",
+ sizeof(rp_ka_timer_xpath));
+
+ nb_cli_enqueue_change(vty, rp_ka_timer_xpath, NB_OP_MODIFY,
+ rpkat);
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+int pim_process_no_rp_kat_cmd(struct vty *vty)
+{
+ const char *vrfname;
+ char rp_ka_timer[6];
+ char rp_ka_timer_xpath[XPATH_MAXLEN];
+ uint v;
+ char rs_timer_xpath[XPATH_MAXLEN];
+
+ snprintf(rs_timer_xpath, sizeof(rs_timer_xpath),
+ FRR_PIM_ROUTER_XPATH, FRR_PIM_AF_XPATH_VAL);
+ strlcat(rs_timer_xpath, "/register-suppress-time",
+ sizeof(rs_timer_xpath));
+
+ /* RFC4601 */
+ v = yang_dnode_get_uint16(vty->candidate_config->dnode,
+ rs_timer_xpath);
+ v = 3 * v + PIM_REGISTER_PROBE_TIME_DEFAULT;
+ if (v > UINT16_MAX)
+ v = UINT16_MAX;
+ snprintf(rp_ka_timer, sizeof(rp_ka_timer), "%u", v);
+
+ vrfname = pim_cli_get_vrf_name(vty);
+ if (vrfname == NULL)
+ return CMD_WARNING_CONFIG_FAILED;
+
+ snprintf(rp_ka_timer_xpath, sizeof(rp_ka_timer_xpath),
+ FRR_PIM_VRF_XPATH, "frr-pim:pimd", "pim", vrfname,
+ FRR_PIM_AF_XPATH_VAL);
+ strlcat(rp_ka_timer_xpath, "/rp-keep-alive-timer",
+ sizeof(rp_ka_timer_xpath));
+
+ nb_cli_enqueue_change(vty, rp_ka_timer_xpath, NB_OP_MODIFY,
+ rp_ka_timer);
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+int pim_process_register_suppress_cmd(struct vty *vty, const char *rst)
+{
+ char xpath[XPATH_MAXLEN];
+
+ snprintf(xpath, sizeof(xpath), FRR_PIM_ROUTER_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+ strlcat(xpath, "/register-suppress-time", sizeof(xpath));
+
+ nb_cli_enqueue_change(vty, xpath, NB_OP_MODIFY, rst);
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+int pim_process_no_register_suppress_cmd(struct vty *vty)
+{
+ char xpath[XPATH_MAXLEN];
+
+ snprintf(xpath, sizeof(xpath), FRR_PIM_ROUTER_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+ strlcat(xpath, "/register-suppress-time", sizeof(xpath));
+
+ nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
+
+ return nb_cli_apply_changes(vty, NULL);
+}
diff --git a/pimd/pim_cmd_common.h b/pimd/pim_cmd_common.h
new file mode 100644
index 0000000000..49fc6bcbeb
--- /dev/null
+++ b/pimd/pim_cmd_common.h
@@ -0,0 +1,39 @@
+/*
+ * PIM for IPv6 FRR
+ * Copyright (C) 2022 Vmware, Inc.
+ * Mobashshera Rasool <mrasool@vmware.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 PIM_CMD_COMMON_H
+#define PIM_CMD_COMMON_H
+
+const char *pim_cli_get_vrf_name(struct vty *vty);
+int pim_process_join_prune_cmd(struct vty *vty, const char *jpi_str);
+int pim_process_no_join_prune_cmd(struct vty *vty);
+int pim_process_spt_switchover_infinity_cmd(struct vty *vty);
+int pim_process_spt_switchover_prefixlist_cmd(struct vty *vty,
+ const char *plist);
+int pim_process_no_spt_switchover_cmd(struct vty *vty);
+int pim_process_pim_packet_cmd(struct vty *vty, const char *packet);
+int pim_process_no_pim_packet_cmd(struct vty *vty);
+int pim_process_keepalivetimer_cmd(struct vty *vty, const char *kat);
+int pim_process_no_keepalivetimer_cmd(struct vty *vty);
+int pim_process_rp_kat_cmd(struct vty *vty, const char *rpkat);
+int pim_process_no_rp_kat_cmd(struct vty *vty);
+int pim_process_register_suppress_cmd(struct vty *vty, const char *rst);
+int pim_process_no_register_suppress_cmd(struct vty *vty);
+
+#endif /* PIM_CMD_COMMON_H */
diff --git a/pimd/pim_static.c b/pimd/pim_static.c
index 45f0a194b0..d3b31771a0 100644
--- a/pimd/pim_static.c
+++ b/pimd/pim_static.c
@@ -305,11 +305,11 @@ int pim_static_write_mroute(struct pim_instance *pim, struct vty *vty,
i);
if (pim_addr_is_any(sroute->source))
vty_out(vty,
- " ip mroute %s %pPA\n",
+ " " PIM_AF_NAME " mroute %s %pPA\n",
oifp->name, &sroute->group);
else
vty_out(vty,
- " ip mroute %s %pPA %pPA\n",
+ " " PIM_AF_NAME " mroute %s %pPA %pPA\n",
oifp->name, &sroute->group,
&sroute->source);
count++;
diff --git a/pimd/pim_vty.c b/pimd/pim_vty.c
index b452b024ed..6de3a04b66 100644
--- a/pimd/pim_vty.c
+++ b/pimd/pim_vty.c
@@ -193,30 +193,30 @@ int pim_global_config_write_worker(struct pim_instance *pim, struct vty *vty)
if (pim->vrf->vrf_id == VRF_DEFAULT) {
if (router->register_suppress_time
!= PIM_REGISTER_SUPPRESSION_TIME_DEFAULT) {
- vty_out(vty, "%sip pim register-suppress-time %d\n",
- spaces, router->register_suppress_time);
+ vty_out(vty, "%s" PIM_AF_NAME " pim register-suppress-time %d\n",
+ spaces, router->register_suppress_time);
++writes;
}
if (router->t_periodic != PIM_DEFAULT_T_PERIODIC) {
- vty_out(vty, "%sip pim join-prune-interval %d\n",
+ vty_out(vty, "%s" PIM_AF_NAME " pim join-prune-interval %d\n",
spaces, router->t_periodic);
++writes;
}
if (router->packet_process != PIM_DEFAULT_PACKET_PROCESS) {
- vty_out(vty, "%sip pim packets %d\n", spaces,
+ vty_out(vty, "%s" PIM_AF_NAME " pim packets %d\n", spaces,
router->packet_process);
++writes;
}
}
if (pim->keep_alive_time != PIM_KEEPALIVE_PERIOD) {
- vty_out(vty, "%sip pim keep-alive-timer %d\n", spaces,
- pim->keep_alive_time);
+ vty_out(vty, "%s" PIM_AF_NAME " pim keep-alive-timer %d\n",
+ spaces, pim->keep_alive_time);
++writes;
}
if (pim->rp_keep_alive_time != (unsigned int)PIM_RP_KEEPALIVE_PERIOD) {
- vty_out(vty, "%sip pim rp keep-alive-timer %d\n", spaces,
- pim->rp_keep_alive_time);
+ vty_out(vty, "%s" PIM_AF_NAME " pim rp keep-alive-timer %d\n",
+ spaces, pim->rp_keep_alive_time);
++writes;
}
if (ssm->plist_name) {
@@ -232,11 +232,11 @@ int pim_global_config_write_worker(struct pim_instance *pim, struct vty *vty)
if (pim->spt.switchover == PIM_SPT_INFINITY) {
if (pim->spt.plist)
vty_out(vty,
- "%sip pim spt-switchover infinity-and-beyond prefix-list %s\n",
+ "%s" PIM_AF_NAME " pim spt-switchover infinity-and-beyond prefix-list %s\n",
spaces, pim->spt.plist);
else
vty_out(vty,
- "%sip pim spt-switchover infinity-and-beyond\n",
+ "%s" PIM_AF_NAME " pim spt-switchover infinity-and-beyond\n",
spaces);
++writes;
}
@@ -281,6 +281,134 @@ int pim_global_config_write_worker(struct pim_instance *pim, struct vty *vty)
return writes;
}
+#if PIM_IPV == 4
+static int pim_igmp_config_write(struct vty *vty, int writes,
+ struct pim_interface *pim_ifp)
+{
+ /* IF ip igmp */
+ if (PIM_IF_TEST_IGMP(pim_ifp->options)) {
+ vty_out(vty, " ip igmp\n");
+ ++writes;
+ }
+
+ /* ip igmp version */
+ if (pim_ifp->igmp_version != IGMP_DEFAULT_VERSION) {
+ vty_out(vty, " ip igmp version %d\n", pim_ifp->igmp_version);
+ ++writes;
+ }
+
+ /* IF ip igmp query-max-response-time */
+ if (pim_ifp->gm_query_max_response_time_dsec !=
+ IGMP_QUERY_MAX_RESPONSE_TIME_DSEC) {
+ vty_out(vty, " ip igmp query-max-response-time %d\n",
+ pim_ifp->gm_query_max_response_time_dsec);
+ ++writes;
+ }
+
+ /* IF ip igmp query-interval */
+ if (pim_ifp->gm_default_query_interval != IGMP_GENERAL_QUERY_INTERVAL) {
+ vty_out(vty, " ip igmp query-interval %d\n",
+ pim_ifp->gm_default_query_interval);
+ ++writes;
+ }
+
+ /* IF ip igmp last-member_query-count */
+ if (pim_ifp->gm_last_member_query_count !=
+ IGMP_DEFAULT_ROBUSTNESS_VARIABLE) {
+ vty_out(vty, " ip igmp last-member-query-count %d\n",
+ pim_ifp->gm_last_member_query_count);
+ ++writes;
+ }
+
+ /* IF ip igmp last-member_query-interval */
+ if (pim_ifp->gm_specific_query_max_response_time_dsec !=
+ IGMP_SPECIFIC_QUERY_MAX_RESPONSE_TIME_DSEC) {
+ vty_out(vty, " ip igmp last-member-query-interval %d\n",
+ pim_ifp->gm_specific_query_max_response_time_dsec);
+ ++writes;
+ }
+
+ /* IF ip igmp join */
+ if (pim_ifp->gm_join_list) {
+ struct listnode *node;
+ struct gm_join *ij;
+ for (ALL_LIST_ELEMENTS_RO(pim_ifp->gm_join_list, node, ij)) {
+ char group_str[INET_ADDRSTRLEN];
+ char source_str[INET_ADDRSTRLEN];
+ pim_inet4_dump("<grp?>", ij->group_addr, group_str,
+ sizeof(group_str));
+ if (ij->source_addr.s_addr == INADDR_ANY) {
+ vty_out(vty, " ip igmp join %s\n", group_str);
+ } else {
+ inet_ntop(AF_INET, &ij->source_addr, source_str,
+ sizeof(source_str));
+ vty_out(vty, " ip igmp join %s %s\n", group_str,
+ source_str);
+ }
+ ++writes;
+ }
+ }
+
+ return writes;
+}
+#endif
+
+int pim_config_write(struct vty *vty, int writes, struct interface *ifp,
+ struct pim_instance *pim)
+{
+ struct pim_interface *pim_ifp = ifp->info;
+
+ if (PIM_IF_TEST_PIM(pim_ifp->options)) {
+ vty_out(vty, " " PIM_AF_NAME " pim\n");
+ ++writes;
+ }
+
+ /* IF ip pim drpriority */
+ if (pim_ifp->pim_dr_priority != PIM_DEFAULT_DR_PRIORITY) {
+ vty_out(vty, " " PIM_AF_NAME " pim drpriority %u\n",
+ pim_ifp->pim_dr_priority);
+ ++writes;
+ }
+
+ /* IF ip pim hello */
+ if (pim_ifp->pim_hello_period != PIM_DEFAULT_HELLO_PERIOD) {
+ vty_out(vty, " " PIM_AF_NAME " pim hello %d", pim_ifp->pim_hello_period);
+ if (pim_ifp->pim_default_holdtime != -1)
+ vty_out(vty, " %d", pim_ifp->pim_default_holdtime);
+ vty_out(vty, "\n");
+ ++writes;
+ }
+
+#if PIM_IPV == 4
+ writes += pim_igmp_config_write(vty, writes, pim_ifp);
+#endif
+
+ /* update source */
+ if (!pim_addr_is_any(pim_ifp->update_source)) {
+ vty_out(vty, " " PIM_AF_NAME " pim use-source %pPA\n",
+ &pim_ifp->update_source);
+ ++writes;
+ }
+
+ if (pim_ifp->activeactive)
+ vty_out(vty, " " PIM_AF_NAME " pim active-active\n");
+
+ /* boundary */
+ if (pim_ifp->boundary_oil_plist) {
+ vty_out(vty, " " PIM_AF_NAME " multicast boundary oil %s\n",
+ pim_ifp->boundary_oil_plist);
+ ++writes;
+ }
+
+ writes += pim_static_write_mroute(pim, vty, ifp);
+ pim_bsm_write_config(vty, ifp);
+ ++writes;
+ pim_bfd_write_config(vty, ifp);
+ ++writes;
+
+ return writes;
+}
+
int pim_interface_config_write(struct vty *vty)
{
struct pim_instance *pim;
@@ -312,144 +440,10 @@ int pim_interface_config_write(struct vty *vty)
}
if (ifp->info) {
- struct pim_interface *pim_ifp = ifp->info;
-
- if (PIM_IF_TEST_PIM(pim_ifp->options)) {
- vty_out(vty, " ip pim\n");
- ++writes;
- }
-
- /* IF ip pim drpriority */
- if (pim_ifp->pim_dr_priority
- != PIM_DEFAULT_DR_PRIORITY) {
- vty_out(vty, " ip pim drpriority %u\n",
- pim_ifp->pim_dr_priority);
- ++writes;
- }
-
- /* IF ip pim hello */
- if (pim_ifp->pim_hello_period
- != PIM_DEFAULT_HELLO_PERIOD) {
- vty_out(vty, " ip pim hello %d",
- pim_ifp->pim_hello_period);
- if (pim_ifp->pim_default_holdtime != -1)
- vty_out(vty, " %d",
- pim_ifp->pim_default_holdtime);
- vty_out(vty, "\n");
- ++writes;
- }
-
- /* update source */
- if (!pim_addr_is_any(pim_ifp->update_source)) {
- vty_out(vty,
- " ip pim use-source %pPA\n",
- &pim_ifp->update_source);
- ++writes;
- }
-
- /* IF ip igmp */
- if (PIM_IF_TEST_IGMP(pim_ifp->options)) {
- vty_out(vty, " ip igmp\n");
- ++writes;
- }
-
- /* ip igmp version */
- if (pim_ifp->igmp_version
- != IGMP_DEFAULT_VERSION) {
- vty_out(vty, " ip igmp version %d\n",
- pim_ifp->igmp_version);
- ++writes;
- }
-
- /* IF ip igmp query-max-response-time */
- if (pim_ifp->gm_query_max_response_time_dsec !=
- IGMP_QUERY_MAX_RESPONSE_TIME_DSEC) {
- vty_out(vty,
- " ip igmp query-max-response-time %d\n",
- pim_ifp->gm_query_max_response_time_dsec);
- ++writes;
- }
-
- /* IF ip igmp query-interval */
- if (pim_ifp->gm_default_query_interval !=
- IGMP_GENERAL_QUERY_INTERVAL) {
- vty_out(vty,
- " ip igmp query-interval %d\n",
- pim_ifp->gm_default_query_interval);
- ++writes;
- }
-
- /* IF ip igmp last-member_query-count */
- if (pim_ifp->gm_last_member_query_count !=
- IGMP_DEFAULT_ROBUSTNESS_VARIABLE) {
- vty_out(vty,
- " ip igmp last-member-query-count %d\n",
- pim_ifp->gm_last_member_query_count);
- ++writes;
- }
-
- /* IF ip igmp last-member_query-interval */
- if (pim_ifp->gm_specific_query_max_response_time_dsec !=
- IGMP_SPECIFIC_QUERY_MAX_RESPONSE_TIME_DSEC) {
- vty_out(vty,
- " ip igmp last-member-query-interval %d\n",
- pim_ifp->gm_specific_query_max_response_time_dsec);
- ++writes;
- }
-
-#if PIM_IPV == 4
- /* IF ip igmp join */
- if (pim_ifp->gm_join_list) {
- struct listnode *node;
- struct gm_join *ij;
- for (ALL_LIST_ELEMENTS_RO(
- pim_ifp->gm_join_list,
- node, ij)) {
- char group_str[INET_ADDRSTRLEN];
- char source_str
- [INET_ADDRSTRLEN];
- pim_inet4_dump(
- "<grp?>",
- ij->group_addr,
- group_str,
- sizeof(group_str));
- if (ij->source_addr.s_addr == INADDR_ANY) {
- vty_out(vty,
- " ip igmp join %s\n",
- group_str);
- } else {
- inet_ntop(AF_INET,
- &ij->source_addr,
- source_str,
- sizeof(source_str));
- vty_out(vty,
- " ip igmp join %s %s\n",
- group_str, source_str);
- }
- ++writes;
- }
- }
-#endif /* PIM_IPV == 4 */
-
- if (pim_ifp->activeactive)
- vty_out(vty, " ip pim active-active\n");
-
- /* boundary */
- if (pim_ifp->boundary_oil_plist) {
- vty_out(vty,
- " ip multicast boundary oil %s\n",
- pim_ifp->boundary_oil_plist);
- ++writes;
- }
-
- writes +=
- pim_static_write_mroute(pim, vty, ifp);
- pim_bsm_write_config(vty, ifp);
- ++writes;
- pim_bfd_write_config(vty, ifp);
- ++writes;
+ pim_config_write(vty, writes, ifp, pim);
}
if_vty_config_end(vty);
+
++writes;
}
}
diff --git a/pimd/pim_vty.h b/pimd/pim_vty.h
index 22ac3333e4..c192ba3bbd 100644
--- a/pimd/pim_vty.h
+++ b/pimd/pim_vty.h
@@ -25,5 +25,6 @@
int pim_debug_config_write(struct vty *vty);
int pim_global_config_write_worker(struct pim_instance *pim, struct vty *vty);
int pim_interface_config_write(struct vty *vty);
-
+int pim_config_write(struct vty *vty, int writes, struct interface *ifp,
+ struct pim_instance *pim);
#endif /* PIM_VTY_H */
diff --git a/pimd/pimd.c b/pimd/pimd.c
index 9621f9794d..58e874fd11 100644
--- a/pimd/pimd.c
+++ b/pimd/pimd.c
@@ -32,7 +32,11 @@
#include "bfd.h"
#include "pimd.h"
+#if PIM_IPV == 4
#include "pim_cmd.h"
+#else
+#include "pim6_cmd.h"
+#endif
#include "pim_str.h"
#include "pim_oil.h"
#include "pim_pim.h"
diff --git a/pimd/subdir.am b/pimd/subdir.am
index 86e8ca780b..0fe40912b1 100644
--- a/pimd/subdir.am
+++ b/pimd/subdir.am
@@ -6,8 +6,12 @@ if PIMD
sbin_PROGRAMS += pimd/pimd
bin_PROGRAMS += pimd/mtracebis
noinst_PROGRAMS += pimd/test_igmpv3_join
-vtysh_scan += pimd/pim_cmd.c
+vtysh_scan += \
+ pimd/pim_cmd.c \
+ pimd/pim6_cmd.c \
+ #end
vtysh_daemons += pimd
+vtysh_daemons += pim6d
man8 += $(MANBUILD)/frr-pimd.8
man8 += $(MANBUILD)/mtracebis.8
endif
@@ -18,6 +22,7 @@ pim_common = \
pimd/pim_bfd.c \
pimd/pim_br.c \
pimd/pim_bsm.c \
+ pimd/pim_cmd_common.c \
pimd/pim_errors.c \
pimd/pim_hello.c \
pimd/pim_iface.c \
@@ -83,9 +88,13 @@ pimd_pim6d_SOURCES = \
$(pim_common) \
pimd/pim6_main.c \
pimd/pim6_stubs.c \
+ pimd/pim6_cmd.c \
# end
nodist_pimd_pim6d_SOURCES = \
+ yang/frr-pim.yang.c \
+ yang/frr-pim-rp.yang.c \
+ yang/frr-gmp.yang.c \
# end
noinst_HEADERS += \
@@ -95,6 +104,7 @@ noinst_HEADERS += \
pimd/pim_br.h \
pimd/pim_bsm.h \
pimd/pim_cmd.h \
+ pimd/pim_cmd_common.h \
pimd/pim_errors.h \
pimd/pim_hello.h \
pimd/pim_iface.h \
@@ -143,10 +153,12 @@ noinst_HEADERS += \
pimd/pimd.h \
pimd/mtracebis_netlink.h \
pimd/mtracebis_routeget.h \
+ pimd/pim6_cmd.h \
# end
clippy_scan += \
pimd/pim_cmd.c \
+ pimd/pim6_cmd.c \
# end
pimd_pimd_CFLAGS = $(AM_CFLAGS) -DPIM_IPV=4
diff --git a/sharpd/sharp_vty.c b/sharpd/sharp_vty.c
index ceed9cf739..78cc57cc44 100644
--- a/sharpd/sharp_vty.c
+++ b/sharpd/sharp_vty.c
@@ -540,7 +540,7 @@ DEFPY(vrf_label, vrf_label_cmd,
vrf = vrf_lookup_by_name(vrf_name);
if (!vrf) {
- vty_out(vty, "Unable to find vrf you silly head");
+ vty_out(vty, "Unable to find vrf you silly head\n");
return CMD_WARNING_CONFIG_FAILED;
}
diff --git a/vtysh/extract.pl.in b/vtysh/extract.pl.in
index c2b4e779de..d940e03e1c 100755
--- a/vtysh/extract.pl.in
+++ b/vtysh/extract.pl.in
@@ -118,7 +118,7 @@ sub scan_file {
if ($defun_array[1] =~ m/ipv6/) {
$protocol = "VTYSH_RIPNGD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ZEBRA|VTYSH_BABELD|VTYSH_ISISD|VTYSH_FABRICD";
} else {
- $protocol = "VTYSH_RIPD|VTYSH_OSPFD|VTYSH_BGPD|VTYSH_ZEBRA|VTYSH_PIMD|VTYSH_EIGRPD|VTYSH_BABELD|VTYSH_ISISD|VTYSH_FABRICD";
+ $protocol = "VTYSH_RIPD|VTYSH_OSPFD|VTYSH_BGPD|VTYSH_ZEBRA|VTYSH_PIMD|VTYSH_PIM6D|VTYSH_EIGRPD|VTYSH_BABELD|VTYSH_ISISD|VTYSH_FABRICD";
}
}
elsif ($file =~ /lib\/if_rmap\.c$/) {
@@ -143,6 +143,10 @@ sub scan_file {
elsif ($fabricd) {
$protocol = "VTYSH_FABRICD";
}
+# Enable VTYSH_PIM6D once pim6_cmd.c is merged
+# elsif ($file =~ /pimd\/pim6_cmd\.c$/) {
+# $protocol = "VTYSH_PIM6D";
+# }
else {
($protocol) = ($file =~ /^(?:.*\/)?([a-z0-9]+)\/[a-zA-Z0-9_\-]+\.c$/);
$protocol = "VTYSH_" . uc $protocol;
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index 336fe8b30e..fe7a2e73ff 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -146,6 +146,7 @@ struct vtysh_client vtysh_client[] = {
{.fd = -1, .name = "bfdd", .flag = VTYSH_BFDD, .next = NULL},
{.fd = -1, .name = "vrrpd", .flag = VTYSH_VRRPD, .next = NULL},
{.fd = -1, .name = "pathd", .flag = VTYSH_PATHD, .next = NULL},
+ {.fd = -1, .name = "pim6d", .flag = VTYSH_PIM6D, .next = NULL},
};
/* Searches for client by name, returns index */
diff --git a/vtysh/vtysh.h b/vtysh/vtysh.h
index 66af248354..757b832a90 100644
--- a/vtysh/vtysh.h
+++ b/vtysh/vtysh.h
@@ -44,6 +44,7 @@ DECLARE_MGROUP(MVTYSH);
#define VTYSH_FABRICD 0x20000
#define VTYSH_VRRPD 0x40000
#define VTYSH_PATHD 0x80000
+#define VTYSH_PIM6D 0x100000
#define VTYSH_WAS_ACTIVE (-2)
@@ -52,10 +53,10 @@ DECLARE_MGROUP(MVTYSH);
/* watchfrr is not in ALL since library CLI functions should not be
* run on it (logging & co. should stay in a fixed/frozen config, and
* things like prefix lists are not even initialised) */
-#define VTYSH_ALL VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_LDPD|VTYSH_BGPD|VTYSH_ISISD|VTYSH_PIMD|VTYSH_NHRPD|VTYSH_EIGRPD|VTYSH_BABELD|VTYSH_SHARPD|VTYSH_PBRD|VTYSH_STATICD|VTYSH_BFDD|VTYSH_FABRICD|VTYSH_VRRPD|VTYSH_PATHD
-#define VTYSH_ACL VTYSH_BFDD|VTYSH_BABELD|VTYSH_BGPD|VTYSH_EIGRPD|VTYSH_ISISD|VTYSH_FABRICD|VTYSH_LDPD|VTYSH_NHRPD|VTYSH_OSPF6D|VTYSH_OSPFD|VTYSH_PBRD|VTYSH_PIMD|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_VRRPD|VTYSH_ZEBRA
-#define VTYSH_RMAP VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ISISD|VTYSH_PIMD|VTYSH_EIGRPD|VTYSH_FABRICD
-#define VTYSH_INTERFACE VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_ISISD|VTYSH_PIMD|VTYSH_NHRPD|VTYSH_EIGRPD|VTYSH_BABELD|VTYSH_PBRD|VTYSH_FABRICD|VTYSH_VRRPD
+#define VTYSH_ALL VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_LDPD|VTYSH_BGPD|VTYSH_ISISD|VTYSH_PIMD|VTYSH_PIM6D|VTYSH_NHRPD|VTYSH_EIGRPD|VTYSH_BABELD|VTYSH_SHARPD|VTYSH_PBRD|VTYSH_STATICD|VTYSH_BFDD|VTYSH_FABRICD|VTYSH_VRRPD|VTYSH_PATHD
+#define VTYSH_ACL VTYSH_BFDD|VTYSH_BABELD|VTYSH_BGPD|VTYSH_EIGRPD|VTYSH_ISISD|VTYSH_FABRICD|VTYSH_LDPD|VTYSH_NHRPD|VTYSH_OSPF6D|VTYSH_OSPFD|VTYSH_PBRD|VTYSH_PIMD|VTYSH_PIM6D|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_VRRPD|VTYSH_ZEBRA
+#define VTYSH_RMAP VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ISISD|VTYSH_PIMD|VTYSH_PIM6D|VTYSH_EIGRPD|VTYSH_FABRICD
+#define VTYSH_INTERFACE VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_ISISD|VTYSH_PIMD|VTYSH_PIM6D|VTYSH_NHRPD|VTYSH_EIGRPD|VTYSH_BABELD|VTYSH_PBRD|VTYSH_FABRICD|VTYSH_VRRPD
#define VTYSH_VRF VTYSH_INTERFACE|VTYSH_STATICD
#define VTYSH_KEYS VTYSH_RIPD | VTYSH_EIGRPD | VTYSH_OSPF6D
/* Daemons who can process nexthop-group configs */
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index 1d9ed4ddd9..bb16232118 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -3425,7 +3425,7 @@ DEFUN (show_evpn_mac_vni_mac,
vni = strtoul(argv[4]->arg, NULL, 10);
if (!prefix_str2mac(argv[6]->arg, &mac)) {
- vty_out(vty, "%% Malformed MAC address");
+ vty_out(vty, "%% Malformed MAC address\n");
return CMD_WARNING;
}
zvrf = zebra_vrf_get_evpn();