Merge pull request #984 from donaldsharp/debugging

Some Small Pim Issues
This commit is contained in:
David Lamparter 2017-08-16 19:18:31 +02:00 committed by GitHub
commit c9974c7995
2 changed files with 68 additions and 17 deletions

View File

@ -1369,7 +1369,7 @@ static void pim_show_interfaces(struct pim_instance *pim, struct vty *vty,
json_object_pim_ifp_add(json_row, ifp); json_object_pim_ifp_add(json_row, ifp);
json_object_int_add(json_row, "pimNeighbors", pim_nbrs); json_object_int_add(json_row, "pimNeighbors", pim_nbrs);
json_object_int_add(json_row, "pimIfChannels", pim_ifchannels); json_object_int_add(json_row, "pimIfChannels", pim_ifchannels);
json_object_int_add(json_row, "firstHopRouter", fhr); json_object_int_add(json_row, "firstHopRouterCount", fhr);
json_object_string_add(json_row, "pimDesignatedRouter", json_object_string_add(json_row, "pimDesignatedRouter",
inet_ntoa(pim_ifp->pim_dr_addr)); inet_ntoa(pim_ifp->pim_dr_addr));
@ -7308,11 +7308,12 @@ DEFUN (interface_pim_use_source,
DEFUN (interface_no_pim_use_source, DEFUN (interface_no_pim_use_source,
interface_no_pim_use_source_cmd, interface_no_pim_use_source_cmd,
"no ip pim use-source", "no ip pim use-source [A.B.C.D]",
NO_STR NO_STR
IP_STR IP_STR
"pim multicast routing\n" "pim multicast routing\n"
"Delete source IP address\n") "Delete source IP address\n"
"source ip address\n")
{ {
return interface_pim_use_src_cmd_worker(vty, "0.0.0.0"); return interface_pim_use_src_cmd_worker(vty, "0.0.0.0");
} }
@ -8397,6 +8398,54 @@ DEFUN (show_ip_msdp_sa_sg,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
DEFUN (show_ip_msdp_sa_sg_vrf_all,
show_ip_msdp_sa_sg_vrf_all_cmd,
"show ip msdp vrf all sa [A.B.C.D [A.B.C.D]] [json]",
SHOW_STR
IP_STR
MSDP_STR
VRF_CMD_HELP_STR
"MSDP active-source information\n"
"source or group ip\n"
"group ip\n"
JSON_STR)
{
u_char uj = use_json(argc, argv);
struct vrf *vrf;
bool first = true;
int idx = 2;
char *src_ip = argv_find(argv, argc, "A.B.C.D", &idx) ? argv[idx++]->arg
: NULL;
char *grp_ip = idx < argc && argv_find(argv, argc, "A.B.C.D", &idx)
? argv[idx]->arg
: NULL;
if (uj)
vty_out(vty, "{ ");
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) {
if (uj) {
if (!first)
vty_out(vty, ", ");
vty_out(vty, " \"%s\": ", vrf->name);
first = false;
} else
vty_out(vty, "VRF: %s\n", vrf->name);
if (src_ip && grp_ip)
ip_msdp_show_sa_sg(vrf->info, vty, src_ip, grp_ip, uj);
else if (src_ip)
ip_msdp_show_sa_addr(vrf->info, vty, src_ip, uj);
else
ip_msdp_show_sa(vrf->info, vty, uj);
}
if (uj)
vty_out(vty, "}\n");
return CMD_SUCCESS;
}
void pim_cmd_init(void) void pim_cmd_init(void)
{ {
install_node(&pim_global_node, pim_global_config_write); /* PIM_NODE */ install_node(&pim_global_node, pim_global_config_write); /* PIM_NODE */
@ -8652,6 +8701,7 @@ void pim_cmd_init(void)
install_element(VIEW_NODE, &show_ip_msdp_sa_detail_cmd); install_element(VIEW_NODE, &show_ip_msdp_sa_detail_cmd);
install_element(VIEW_NODE, &show_ip_msdp_sa_detail_vrf_all_cmd); install_element(VIEW_NODE, &show_ip_msdp_sa_detail_vrf_all_cmd);
install_element(VIEW_NODE, &show_ip_msdp_sa_sg_cmd); install_element(VIEW_NODE, &show_ip_msdp_sa_sg_cmd);
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_cmd);
install_element(VIEW_NODE, &show_ip_msdp_mesh_group_vrf_all_cmd); install_element(VIEW_NODE, &show_ip_msdp_mesh_group_vrf_all_cmd);
install_element(VIEW_NODE, &show_ip_pim_ssm_range_cmd); install_element(VIEW_NODE, &show_ip_pim_ssm_range_cmd);

View File

@ -167,8 +167,9 @@ struct pim_upstream *pim_upstream_del(struct pim_instance *pim,
if (PIM_DEBUG_TRACE) if (PIM_DEBUG_TRACE)
zlog_debug( zlog_debug(
"%s(%s): Delete %s ref count: %d , flags: %d c_oil ref count %d (Pre decrement)", "%s(%s): Delete %s[%s] ref count: %d , flags: %d c_oil ref count %d (Pre decrement)",
__PRETTY_FUNCTION__, name, up->sg_str, up->ref_count, __PRETTY_FUNCTION__, name, up->sg_str,
pim->vrf->name, up->ref_count,
up->flags, up->channel_oil->oil_ref_count); up->flags, up->channel_oil->oil_ref_count);
--up->ref_count; --up->ref_count;
@ -948,8 +949,8 @@ void pim_upstream_rpf_genid_changed(struct pim_instance *pim,
pim_addr_dump("<rpf?>", &up->rpf.rpf_addr, rpf_addr_str, pim_addr_dump("<rpf?>", &up->rpf.rpf_addr, rpf_addr_str,
sizeof(rpf_addr_str)); sizeof(rpf_addr_str));
zlog_debug( zlog_debug(
"%s: matching neigh=%s against upstream (S,G)=%s joined=%d rpf_addr=%s", "%s: matching neigh=%s against upstream (S,G)=%s[%s] joined=%d rpf_addr=%s",
__PRETTY_FUNCTION__, neigh_str, up->sg_str, __PRETTY_FUNCTION__, neigh_str, up->sg_str, pim->vrf->name,
up->join_state == PIM_UPSTREAM_JOINED, up->join_state == PIM_UPSTREAM_JOINED,
rpf_addr_str); rpf_addr_str);
} }
@ -1106,8 +1107,8 @@ static int pim_upstream_keep_alive_timer(struct thread *t)
if (PIM_UPSTREAM_FLAG_TEST_SRC_STREAM(up->flags)) { if (PIM_UPSTREAM_FLAG_TEST_SRC_STREAM(up->flags)) {
pim_upstream_fhr_kat_expiry(pim, up); pim_upstream_fhr_kat_expiry(pim, up);
if (PIM_DEBUG_TRACE) if (PIM_DEBUG_TRACE)
zlog_debug("kat expired on %s; remove stream reference", zlog_debug("kat expired on %s[%s]; remove stream reference",
up->sg_str); up->sg_str, pim->vrf->name);
PIM_UPSTREAM_FLAG_UNSET_SRC_STREAM(up->flags); PIM_UPSTREAM_FLAG_UNSET_SRC_STREAM(up->flags);
pim_upstream_del(pim, up, __PRETTY_FUNCTION__); pim_upstream_del(pim, up, __PRETTY_FUNCTION__);
} else if (PIM_UPSTREAM_FLAG_TEST_SRC_LHR(up->flags)) { } else if (PIM_UPSTREAM_FLAG_TEST_SRC_LHR(up->flags)) {
@ -1334,8 +1335,8 @@ static int pim_upstream_register_stop_timer(struct thread *t)
if (PIM_DEBUG_TRACE) { if (PIM_DEBUG_TRACE) {
char state_str[PIM_REG_STATE_STR_LEN]; char state_str[PIM_REG_STATE_STR_LEN];
zlog_debug("%s: (S,G)=%s upstream register stop timer %s", zlog_debug("%s: (S,G)=%s[%s] upstream register stop timer %s",
__PRETTY_FUNCTION__, up->sg_str, __PRETTY_FUNCTION__, up->sg_str, pim->vrf->name,
pim_reg_state2str(up->reg_state, state_str)); pim_reg_state2str(up->reg_state, state_str));
} }
@ -1637,8 +1638,8 @@ static void pim_upstream_sg_running(void *arg)
if (up->channel_oil->oil_inherited_rescan) { if (up->channel_oil->oil_inherited_rescan) {
if (PIM_DEBUG_TRACE) if (PIM_DEBUG_TRACE)
zlog_debug( zlog_debug(
"%s: Handling unscanned inherited_olist for %s", "%s: Handling unscanned inherited_olist for %s[%s]",
__PRETTY_FUNCTION__, up->sg_str); __PRETTY_FUNCTION__, up->sg_str, pim->vrf->name);
pim_upstream_inherited_olist_decide(pim, up); pim_upstream_inherited_olist_decide(pim, up);
up->channel_oil->oil_inherited_rescan = 0; up->channel_oil->oil_inherited_rescan = 0;
} }
@ -1649,8 +1650,8 @@ static void pim_upstream_sg_running(void *arg)
&& (up->channel_oil->cc.lastused / 100 > 30)) { && (up->channel_oil->cc.lastused / 100 > 30)) {
if (PIM_DEBUG_TRACE) { if (PIM_DEBUG_TRACE) {
zlog_debug( zlog_debug(
"%s: %s old packet count is equal or lastused is greater than 30, (%ld,%ld,%lld)", "%s[%s]: %s old packet count is equal or lastused is greater than 30, (%ld,%ld,%lld)",
__PRETTY_FUNCTION__, up->sg_str, __PRETTY_FUNCTION__, up->sg_str, pim->vrf->name,
up->channel_oil->cc.oldpktcnt, up->channel_oil->cc.oldpktcnt,
up->channel_oil->cc.pktcnt, up->channel_oil->cc.pktcnt,
up->channel_oil->cc.lastused / 100); up->channel_oil->cc.lastused / 100);
@ -1664,8 +1665,8 @@ static void pim_upstream_sg_running(void *arg)
if (!PIM_UPSTREAM_FLAG_TEST_SRC_STREAM(up->flags)) { if (!PIM_UPSTREAM_FLAG_TEST_SRC_STREAM(up->flags)) {
if (PIM_DEBUG_TRACE) if (PIM_DEBUG_TRACE)
zlog_debug( zlog_debug(
"source reference created on kat restart %s", "source reference created on kat restart %s[%s]",
up->sg_str); up->sg_str, pim->vrf->name);
pim_upstream_ref(up, PIM_UPSTREAM_FLAG_MASK_SRC_STREAM, pim_upstream_ref(up, PIM_UPSTREAM_FLAG_MASK_SRC_STREAM,
__PRETTY_FUNCTION__); __PRETTY_FUNCTION__);