summaryrefslogtreecommitdiffstats
path: root/pimd
diff options
context:
space:
mode:
authorBalaji Gurudoss <G_Balaji1@dell.com>2022-04-04 15:01:50 +0200
committerBalaji Gurudoss <G_Balaji1@dell.com>2022-04-12 14:37:24 +0200
commita8caf78d611c09d3416fc21c4d193d9f41f92a18 (patch)
treeb730fee2cc77da0f4b0054a5b8dfde7626d0bc4c /pimd
parentMerge pull request #10979 from opensourcerouting/pim-ssm-clean (diff)
downloadfrr-a8caf78d611c09d3416fc21c4d193d9f41f92a18.tar.xz
frr-a8caf78d611c09d3416fc21c4d193d9f41f92a18.zip
pim6d: Addition of ipv6 ssmpingd config commands
Signed-off-by: Balaji Gurudoss <G_Balaji1@dell.com>
Diffstat (limited to 'pimd')
-rw-r--r--pimd/pim6_cmd.c31
-rw-r--r--pimd/pim6_cmd.h1
-rw-r--r--pimd/pim_cmd.c38
-rw-r--r--pimd/pim_cmd_common.c22
-rw-r--r--pimd/pim_cmd_common.h2
-rw-r--r--pimd/pim_ssmpingd.c6
-rw-r--r--pimd/pim_vty.c4
7 files changed, 64 insertions, 40 deletions
diff --git a/pimd/pim6_cmd.c b/pimd/pim6_cmd.c
index 5d7a63372..90840a95e 100644
--- a/pimd/pim6_cmd.c
+++ b/pimd/pim6_cmd.c
@@ -451,6 +451,33 @@ DEFPY (no_ipv6_pim_rp_prefix_list,
return pim_process_no_rp_plist_cmd(vty, rp_str, plist);
}
+
+DEFPY (ipv6_ssmpingd,
+ ipv6_ssmpingd_cmd,
+ "ipv6 ssmpingd [X:X::X:X]$source",
+ IPV6_STR
+ CONF_SSMPINGD_STR
+ "Source address\n")
+{
+ const char *src_str = (source_str) ? source_str : "::";
+
+ return pim_process_ssmpingd_cmd(vty, NB_OP_CREATE, src_str);
+}
+
+
+DEFPY (no_ipv6_ssmpingd,
+ no_ipv6_ssmpingd_cmd,
+ "no ipv6 ssmpingd [X:X::X:X]$source",
+ NO_STR
+ IPV6_STR
+ CONF_SSMPINGD_STR
+ "Source address\n")
+{
+ const char *src_str = (source_str) ? source_str : "::";
+
+ return pim_process_ssmpingd_cmd(vty, NB_OP_DESTROY, src_str);
+}
+
DEFPY (interface_ipv6_mld_join,
interface_ipv6_mld_join_cmd,
"ipv6 mld join X:X::X:X$group [X:X::X:X$source]",
@@ -1588,6 +1615,10 @@ void pim_cmd_init(void)
install_element(VRF_NODE, &ipv6_pim_rp_prefix_list_cmd);
install_element(CONFIG_NODE, &no_ipv6_pim_rp_prefix_list_cmd);
install_element(VRF_NODE, &no_ipv6_pim_rp_prefix_list_cmd);
+ install_element(CONFIG_NODE, &ipv6_ssmpingd_cmd);
+ install_element(VRF_NODE, &ipv6_ssmpingd_cmd);
+ install_element(CONFIG_NODE, &no_ipv6_ssmpingd_cmd);
+ install_element(VRF_NODE, &no_ipv6_ssmpingd_cmd);
install_element(INTERFACE_NODE, &interface_ipv6_mld_cmd);
install_element(INTERFACE_NODE, &interface_no_ipv6_mld_cmd);
install_element(INTERFACE_NODE, &interface_ipv6_mld_join_cmd);
diff --git a/pimd/pim6_cmd.h b/pimd/pim6_cmd.h
index ac5eb3f9b..d6853a741 100644
--- a/pimd/pim6_cmd.h
+++ b/pimd/pim6_cmd.h
@@ -43,6 +43,7 @@
#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"
+#define CONF_SSMPINGD_STR "Enable ssmpingd operation\n"
void pim_cmd_init(void);
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 78fc97578..539b7303b 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -5314,24 +5314,9 @@ DEFUN (ip_ssmpingd,
"Source address\n")
{
int idx_ipv4 = 2;
- const char *source_str = (argc == 3) ? argv[idx_ipv4]->arg : "0.0.0.0";
- const char *vrfname;
- char ssmpingd_ip_xpath[XPATH_MAXLEN];
-
- vrfname = pim_cli_get_vrf_name(vty);
- if (vrfname == NULL)
- return CMD_WARNING_CONFIG_FAILED;
+ const char *src_str = (argc == 3) ? argv[idx_ipv4]->arg : "0.0.0.0";
- snprintf(ssmpingd_ip_xpath, sizeof(ssmpingd_ip_xpath),
- FRR_PIM_VRF_XPATH,
- "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4");
- strlcat(ssmpingd_ip_xpath, "/ssm-pingd-source-ip",
- sizeof(ssmpingd_ip_xpath));
-
- nb_cli_enqueue_change(vty, ssmpingd_ip_xpath, NB_OP_CREATE,
- source_str);
-
- return nb_cli_apply_changes(vty, NULL);
+ return pim_process_ssmpingd_cmd(vty, NB_OP_CREATE, src_str);
}
DEFUN (no_ip_ssmpingd,
@@ -5342,25 +5327,10 @@ DEFUN (no_ip_ssmpingd,
CONF_SSMPINGD_STR
"Source address\n")
{
- const char *vrfname;
int idx_ipv4 = 3;
- const char *source_str = (argc == 4) ? argv[idx_ipv4]->arg : "0.0.0.0";
- char ssmpingd_ip_xpath[XPATH_MAXLEN];
-
- vrfname = pim_cli_get_vrf_name(vty);
- if (vrfname == NULL)
- return CMD_WARNING_CONFIG_FAILED;
+ const char *src_str = (argc == 4) ? argv[idx_ipv4]->arg : "0.0.0.0";
- snprintf(ssmpingd_ip_xpath, sizeof(ssmpingd_ip_xpath),
- FRR_PIM_VRF_XPATH,
- "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4");
- strlcat(ssmpingd_ip_xpath, "/ssm-pingd-source-ip",
- sizeof(ssmpingd_ip_xpath));
-
- nb_cli_enqueue_change(vty, ssmpingd_ip_xpath, NB_OP_DESTROY,
- source_str);
-
- return nb_cli_apply_changes(vty, NULL);
+ return pim_process_ssmpingd_cmd(vty, NB_OP_DESTROY, src_str);
}
DEFUN (ip_pim_ecmp,
diff --git a/pimd/pim_cmd_common.c b/pimd/pim_cmd_common.c
index 0992a60de..fa61cfc06 100644
--- a/pimd/pim_cmd_common.c
+++ b/pimd/pim_cmd_common.c
@@ -2840,3 +2840,25 @@ int gm_process_no_last_member_query_interval_cmd(struct vty *vty)
return nb_cli_apply_changes(vty, FRR_GMP_INTERFACE_XPATH,
FRR_PIM_AF_XPATH_VAL);
}
+
+
+int pim_process_ssmpingd_cmd(struct vty *vty, enum nb_operation operation,
+ const char *src_str)
+{
+ const char *vrfname;
+ char ssmpingd_ip_xpath[XPATH_MAXLEN];
+
+ vrfname = pim_cli_get_vrf_name(vty);
+ if (vrfname == NULL)
+ return CMD_WARNING_CONFIG_FAILED;
+
+ snprintf(ssmpingd_ip_xpath, sizeof(ssmpingd_ip_xpath),
+ FRR_PIM_VRF_XPATH, "frr-pim:pimd", "pim", vrfname,
+ FRR_PIM_AF_XPATH_VAL);
+ strlcat(ssmpingd_ip_xpath, "/ssm-pingd-source-ip",
+ sizeof(ssmpingd_ip_xpath));
+
+ nb_cli_enqueue_change(vty, ssmpingd_ip_xpath, operation, src_str);
+
+ return nb_cli_apply_changes(vty, NULL);
+}
diff --git a/pimd/pim_cmd_common.h b/pimd/pim_cmd_common.h
index 3bcd0d5d6..f5e0ef587 100644
--- a/pimd/pim_cmd_common.h
+++ b/pimd/pim_cmd_common.h
@@ -102,6 +102,8 @@ int gm_process_no_last_member_query_count_cmd(struct vty *vty);
int gm_process_last_member_query_interval_cmd(struct vty *vty,
const char *lmqi_str);
int gm_process_no_last_member_query_interval_cmd(struct vty *vty);
+int pim_process_ssmpingd_cmd(struct vty *vty, enum nb_operation operation,
+ const char *src_str);
/*
* Special Macro to allow us to get the correct pim_instance
*/
diff --git a/pimd/pim_ssmpingd.c b/pimd/pim_ssmpingd.c
index afa7e37da..d86be85bd 100644
--- a/pimd/pim_ssmpingd.c
+++ b/pimd/pim_ssmpingd.c
@@ -361,10 +361,8 @@ int pim_ssmpingd_start(struct pim_instance *pim, pim_addr source_addr)
return 0;
}
- {
- zlog_info("%s: starting ssmpingd for source %pPAs", __func__,
- &source_addr);
- }
+ zlog_info("%s: starting ssmpingd for source %pPAs", __func__,
+ &source_addr);
ss = ssmpingd_new(pim, source_addr);
if (!ss) {
diff --git a/pimd/pim_vty.c b/pimd/pim_vty.c
index b360181f4..b0db6b4d9 100644
--- a/pimd/pim_vty.c
+++ b/pimd/pim_vty.c
@@ -264,8 +264,8 @@ int pim_global_config_write_worker(struct pim_instance *pim, struct vty *vty)
struct ssmpingd_sock *ss;
++writes;
for (ALL_LIST_ELEMENTS_RO(pim->ssmpingd_list, node, ss)) {
- vty_out(vty, "%sip ssmpingd %pPA\n", spaces,
- &ss->source_addr);
+ vty_out(vty, "%s" PIM_AF_NAME " ssmpingd %pPA\n",
+ spaces, &ss->source_addr);
++writes;
}
}