Skip to content

Commit

Permalink
Merge pull request FRRouting#17469 from opensourcerouting/msdp-logs
Browse files Browse the repository at this point in the history
pimd: MSDP logging improvements
  • Loading branch information
donaldsharp authored Nov 21, 2024
2 parents 9af78e2 + 0b0648f commit 0af5c2a
Show file tree
Hide file tree
Showing 12 changed files with 253 additions and 124 deletions.
33 changes: 33 additions & 0 deletions pimd/pim_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -8267,6 +8267,37 @@ DEFUN (show_ip_msdp_sa_sg_vrf_all,
return CMD_SUCCESS;
}

DEFPY(msdp_log_neighbor_changes, msdp_log_neighbor_changes_cmd,
"[no] msdp log neighbor-events",
NO_STR
MSDP_STR
"MSDP log messages\n"
"MSDP log neighbor event messages\n")
{
char xpath_value[XPATH_MAXLEN + 32];

snprintf(xpath_value, sizeof(xpath_value), "%s/msdp/log-neighbor-events", VTY_CURR_XPATH);
nb_cli_enqueue_change(vty, xpath_value, no ? NB_OP_DESTROY : NB_OP_MODIFY, "true");

return nb_cli_apply_changes(vty, NULL);
}

DEFPY(msdp_log_sa_changes, msdp_log_sa_changes_cmd,
"[no] msdp log sa-events",
NO_STR
MSDP_STR
"MSDP log messages\n"
"MSDP log SA event messages\n")
{
char xpath_value[XPATH_MAXLEN + 32];

snprintf(xpath_value, sizeof(xpath_value), "%s/msdp/log-sa-events", VTY_CURR_XPATH);
nb_cli_enqueue_change(vty, xpath_value, no ? NB_OP_DESTROY : NB_OP_MODIFY, "true");

return nb_cli_apply_changes(vty, NULL);
}


struct pim_sg_cache_walk_data {
struct vty *vty;
json_object *json;
Expand Down Expand Up @@ -8898,6 +8929,8 @@ void pim_cmd_init(void)
install_element(PIM_NODE, &pim_msdp_mesh_group_source_cmd);
install_element(PIM_NODE, &no_pim_msdp_mesh_group_source_cmd);
install_element(PIM_NODE, &no_pim_msdp_mesh_group_cmd);
install_element(PIM_NODE, &msdp_log_neighbor_changes_cmd);
install_element(PIM_NODE, &msdp_log_sa_changes_cmd);

install_element(PIM_NODE, &pim_bsr_candidate_rp_cmd);
install_element(PIM_NODE, &pim_bsr_candidate_rp_group_cmd);
Expand Down
10 changes: 10 additions & 0 deletions pimd/pim_instance.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,3 +272,13 @@ void pim_vrf_terminate(void)

vrf_terminate();
}

bool pim_msdp_log_neighbor_events(const struct pim_instance *pim)
{
return (pim->log_flags & PIM_MSDP_LOG_NEIGHBOR_EVENTS);
}

bool pim_msdp_log_sa_events(const struct pim_instance *pim)
{
return (pim->log_flags & PIM_MSDP_LOG_SA_EVENTS);
}
10 changes: 10 additions & 0 deletions pimd/pim_instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,13 @@ struct pim_instance {

uint64_t gm_rx_drop_sys;

/** Log information flags. */
uint32_t log_flags;
/** Log neighbor event messages. */
#define PIM_MSDP_LOG_NEIGHBOR_EVENTS 0x01
/** Log SA event messages. */
#define PIM_MSDP_LOG_SA_EVENTS 0x02

bool stopping;

#if PIM_IPV == 6
Expand All @@ -218,4 +225,7 @@ extern struct pim_router *router;

struct pim_instance *pim_get_pim_instance(vrf_id_t vrf_id);

extern bool pim_msdp_log_neighbor_events(const struct pim_instance *pim);
extern bool pim_msdp_log_sa_events(const struct pim_instance *pim);

#endif
Loading

0 comments on commit 0af5c2a

Please sign in to comment.