summaryrefslogtreecommitdiffstats
path: root/pimd/pim_cmd_common.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:24:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:24:32 +0000
commit35cadacd2bb9383686753731e31bd7e145fb2506 (patch)
tree4489adbde75a837989533837185b2b8369a0bf68 /pimd/pim_cmd_common.c
parentAdding debian version 9.1-0.1. (diff)
downloadfrr-35cadacd2bb9383686753731e31bd7e145fb2506.tar.xz
frr-35cadacd2bb9383686753731e31bd7e145fb2506.zip
Merging upstream version 10.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pimd/pim_cmd_common.c')
-rw-r--r--pimd/pim_cmd_common.c63
1 files changed, 34 insertions, 29 deletions
diff --git a/pimd/pim_cmd_common.c b/pimd/pim_cmd_common.c
index c3eb49d..ee318d4 100644
--- a/pimd/pim_cmd_common.c
+++ b/pimd/pim_cmd_common.c
@@ -6,6 +6,7 @@
*/
#include <zebra.h>
+#include <sys/ioctl.h>
#include "lib/json.h"
#include "command.h"
@@ -68,7 +69,7 @@ const char *pim_cli_get_vrf_name(struct vty *vty)
return NULL;
}
- return yang_dnode_get_string(vrf_node, "./name");
+ return yang_dnode_get_string(vrf_node, "name");
}
int pim_process_join_prune_cmd(struct vty *vty, const char *jpi_str)
@@ -524,7 +525,9 @@ int pim_process_rp_cmd(struct vty *vty, const char *rp_str,
const char *group_str)
{
const char *vrfname;
- char rp_group_xpath[XPATH_MAXLEN];
+ char group_xpath[XPATH_MAXLEN];
+ char rp_xpath[XPATH_MAXLEN];
+ int printed;
int result = 0;
struct prefix group;
pim_addr rp_addr;
@@ -569,12 +572,18 @@ int pim_process_rp_cmd(struct vty *vty, const char *rp_str,
if (vrfname == NULL)
return CMD_WARNING_CONFIG_FAILED;
- snprintf(rp_group_xpath, sizeof(rp_group_xpath),
- FRR_PIM_STATIC_RP_XPATH, "frr-pim:pimd", "pim", vrfname,
- FRR_PIM_AF_XPATH_VAL, rp_str);
- strlcat(rp_group_xpath, "/group-list", sizeof(rp_group_xpath));
+ snprintf(rp_xpath, sizeof(rp_xpath), FRR_PIM_STATIC_RP_XPATH,
+ "frr-pim:pimd", "pim", vrfname, FRR_PIM_AF_XPATH_VAL, rp_str);
+ printed = snprintf(group_xpath, sizeof(group_xpath),
+ "%s/group-list[.='%s']", rp_xpath, group_str);
+
+ if (printed >= (int)(sizeof(group_xpath))) {
+ vty_out(vty, "Xpath too long (%d > %u)", printed + 1,
+ XPATH_MAXLEN);
+ return CMD_WARNING_CONFIG_FAILED;
+ }
- nb_cli_enqueue_change(vty, rp_group_xpath, NB_OP_CREATE, group_str);
+ nb_cli_enqueue_change(vty, group_xpath, NB_OP_CREATE, NULL);
return nb_cli_apply_changes(vty, NULL);
}
@@ -582,7 +591,6 @@ int pim_process_rp_cmd(struct vty *vty, const char *rp_str,
int pim_process_no_rp_cmd(struct vty *vty, const char *rp_str,
const char *group_str)
{
- char group_list_xpath[XPATH_MAXLEN];
char group_xpath[XPATH_MAXLEN];
char rp_xpath[XPATH_MAXLEN];
int printed;
@@ -595,18 +603,8 @@ int pim_process_no_rp_cmd(struct vty *vty, const char *rp_str,
snprintf(rp_xpath, sizeof(rp_xpath), FRR_PIM_STATIC_RP_XPATH,
"frr-pim:pimd", "pim", vrfname, FRR_PIM_AF_XPATH_VAL, rp_str);
-
- printed = snprintf(group_list_xpath, sizeof(group_list_xpath),
- "%s/group-list", rp_xpath);
-
- if (printed >= (int)(sizeof(group_list_xpath))) {
- vty_out(vty, "Xpath too long (%d > %u)", printed + 1,
- XPATH_MAXLEN);
- return CMD_WARNING_CONFIG_FAILED;
- }
-
- printed = snprintf(group_xpath, sizeof(group_xpath), "%s[.='%s']",
- group_list_xpath, group_str);
+ printed = snprintf(group_xpath, sizeof(group_xpath),
+ "%s/group-list[.='%s']", rp_xpath, group_str);
if (printed >= (int)(sizeof(group_xpath))) {
vty_out(vty, "Xpath too long (%d > %u)", printed + 1,
@@ -623,8 +621,7 @@ int pim_process_no_rp_cmd(struct vty *vty, const char *rp_str,
if (yang_is_last_list_dnode(group_dnode))
nb_cli_enqueue_change(vty, rp_xpath, NB_OP_DESTROY, NULL);
else
- nb_cli_enqueue_change(vty, group_list_xpath, NB_OP_DESTROY,
- group_str);
+ nb_cli_enqueue_change(vty, group_xpath, NB_OP_DESTROY, NULL);
return nb_cli_apply_changes(vty, NULL);
}
@@ -1059,8 +1056,8 @@ void pim_show_state(struct pim_instance *pim, struct vty *vty,
frr_each (rb_pim_oil, &pim->channel_oil_head, c_oil) {
char src_str[PIM_ADDRSTRLEN];
char grp_str[PIM_ADDRSTRLEN];
- char in_ifname[INTERFACE_NAMSIZ + 1];
- char out_ifname[INTERFACE_NAMSIZ + 1];
+ char in_ifname[IFNAMSIZ + 1];
+ char out_ifname[IFNAMSIZ + 1];
int oif_vif_index;
struct interface *ifp_in;
bool isRpt;
@@ -3406,6 +3403,8 @@ int pim_process_ssmpingd_cmd(struct vty *vty, enum nb_operation operation,
{
const char *vrfname;
char ssmpingd_ip_xpath[XPATH_MAXLEN];
+ char ssmpingd_src_ip_xpath[XPATH_MAXLEN];
+ int printed;
vrfname = pim_cli_get_vrf_name(vty);
if (vrfname == NULL)
@@ -3414,10 +3413,16 @@ int pim_process_ssmpingd_cmd(struct vty *vty, enum nb_operation operation,
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));
+ printed = snprintf(ssmpingd_src_ip_xpath, sizeof(ssmpingd_src_ip_xpath),
+ "%s/ssm-pingd-source-ip[.='%s']", ssmpingd_ip_xpath,
+ src_str);
+ if (printed >= (int)sizeof(ssmpingd_src_ip_xpath)) {
+ vty_out(vty, "Xpath too long (%d > %u)", printed + 1,
+ XPATH_MAXLEN);
+ return CMD_WARNING_CONFIG_FAILED;
+ }
- nb_cli_enqueue_change(vty, ssmpingd_ip_xpath, operation, src_str);
+ nb_cli_enqueue_change(vty, ssmpingd_src_ip_xpath, operation, NULL);
return nb_cli_apply_changes(vty, NULL);
}
@@ -3662,8 +3667,8 @@ void show_mroute(struct pim_instance *pim, struct vty *vty, pim_sgaddr *sg,
int first;
char grp_str[PIM_ADDRSTRLEN];
char src_str[PIM_ADDRSTRLEN];
- char in_ifname[INTERFACE_NAMSIZ + 1];
- char out_ifname[INTERFACE_NAMSIZ + 1];
+ char in_ifname[IFNAMSIZ + 1];
+ char out_ifname[IFNAMSIZ + 1];
int oif_vif_index;
struct interface *ifp_in;
char proto[100];