From: Sarita Patra Date: Mon, 9 Mar 2020 06:23:16 +0000 (-0700) Subject: pimd: add flags in show ip mroute command X-Git-Tag: base_7.4~235^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F5940%2Fhead;p=mirror%2Ffrr.git pimd: add flags in show ip mroute command S - Sparse Mode C - indicates there is a member of the group directly connected to the router. R -set on an (S, G) by the receipt of an (S, G) RP bit prune message. F -This indicates that this router is a FHR and send register messages to RP to inform RP of this active source P - OIL list is NULL. That means the router will send a prune. T - At least one packet received via SPT. Signed-off-by: Sarita Patra --- diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index abc1548967..0d9d00a2d7 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -5790,13 +5790,18 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty, int oif_vif_index; struct interface *ifp_in; char proto[100]; + char state_str[PIM_REG_STATE_STR_LEN]; char mroute_uptime[10]; if (uj) { json = json_object_new_object(); } else { + vty_out(vty, "IP Multicast Routing Table\n"); + vty_out(vty, "Flags: S- Sparse, C - Connected, P - Pruned\n"); vty_out(vty, - "Source Group Proto Input Output TTL Uptime\n"); + " R - RP-bit set, F - Register flag, T - SPT-bit set\n"); + vty_out(vty, + "\nSource Group Flags Proto Input Output TTL Uptime\n"); } now = pim_time_monotonic_sec(); @@ -5819,6 +5824,23 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty, sizeof(grp_str)); pim_inet4_dump("", c_oil->oil.mfcc_origin, src_str, sizeof(src_str)); + + strlcpy(state_str, "S", sizeof(state_str)); + /* When a non DR receives a igmp join, it creates a (*,G) + * channel_oil without any upstream creation */ + if (c_oil->up) { + if (PIM_UPSTREAM_FLAG_TEST_SRC_IGMP(c_oil->up->flags)) + strlcat(state_str, "C", sizeof(state_str)); + if (pim_upstream_is_sg_rpt(c_oil->up)) + strlcat(state_str, "R", sizeof(state_str)); + if (PIM_UPSTREAM_FLAG_TEST_FHR(c_oil->up->flags)) + strlcat(state_str, "F", sizeof(state_str)); + if (c_oil->up->sptbit == PIM_UPSTREAM_SPTBIT_TRUE) + strlcat(state_str, "T", sizeof(state_str)); + } + if (pim_channel_oil_empty(c_oil)) + strlcat(state_str, "P", sizeof(state_str)); + ifp_in = pim_if_find_by_vif_index(pim, c_oil->oil.mfcc_parent); if (ifp_in) @@ -5842,7 +5864,8 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty, } /* Find the source nested under the group, create it if - * it doesn't exist */ + * it doesn't exist + */ json_object_object_get_ex(json_group, src_str, &json_source); @@ -5965,14 +5988,16 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty, } vty_out(vty, - "%-15s %-15s %-6s %-16s %-16s %-3d %8s\n", - src_str, grp_str, proto, in_ifname, - out_ifname, ttl, mroute_uptime); + "%-15s %-15s %-15s %-6s %-16s %-16s %-3d %8s\n", + src_str, grp_str, state_str, proto, + in_ifname, out_ifname, ttl, + mroute_uptime); if (first) { src_str[0] = '\0'; grp_str[0] = '\0'; in_ifname[0] = '\0'; + state_str[0] = '\0'; mroute_uptime[0] = '\0'; first = 0; } @@ -5980,9 +6005,10 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty, } if (!uj && !found_oif) { - vty_out(vty, "%-15s %-15s %-6s %-16s %-16s %-3d %8s\n", - src_str, grp_str, "none", in_ifname, "none", 0, - "--:--:--"); + vty_out(vty, + "%-15s %-15s %-15s %-6s %-16s %-16s %-3d %8s\n", + src_str, grp_str, state_str, "none", in_ifname, + "none", 0, "--:--:--"); } }