mirror of
				https://git.proxmox.com/git/mirror_frr
				synced 2025-11-04 15:30:26 +00:00 
			
		
		
		
	pimd: display reg-state and join-state info in the pim_upstream output
Changed the state field in the "sh ip pim upstream" output to include register and join state info as a comma separated value. Register info is supressed if reg-state=NoInfo. Sample output: ============= root@fhr:/home/cumulus# net show pim upstream Iif Source Group State Uptime JoinTimer RSTimer KATimer RefCnt swp1 33.1.1.1 239.1.1.2 J,RegP 00:00:18 --:--:-- 00:00:44 00:03:24 2 root@fhr:/home/cumulus# root@rp:/home/cumulus# net show pim upstream Iif Source Group State Uptime JoinTimer RSTimer KATimer RefCnt lo * 239.1.1.2 J 00:02:08 00:00:52 --:--:-- --:--:-- 1 swp1 33.1.1.1 239.1.1.2 J 00:00:16 00:00:11 --:--:-- 00:03:26 1 root@rp:/home/cumulus# Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Ticket: CM-14700 Testing Done: pim-smoke
This commit is contained in:
		
							parent
							
								
									b4786acd7e
								
							
						
					
					
						commit
						755210ab1d
					
				@ -1643,6 +1643,44 @@ json_object_pim_upstream_add (json_object *json, struct pim_upstream *up)
 | 
			
		||||
    json_object_boolean_true_add(json, "sourceMsdp");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const char *
 | 
			
		||||
pim_upstream_state2brief_str (enum pim_upstream_state join_state, char *state_str)
 | 
			
		||||
{
 | 
			
		||||
  switch (join_state)
 | 
			
		||||
    {
 | 
			
		||||
    case PIM_UPSTREAM_NOTJOINED:
 | 
			
		||||
      strcpy (state_str, "NotJ");
 | 
			
		||||
      break;
 | 
			
		||||
    case PIM_UPSTREAM_JOINED:
 | 
			
		||||
      strcpy (state_str, "J");
 | 
			
		||||
      break;
 | 
			
		||||
    default:
 | 
			
		||||
      strcpy (state_str, "Unk");
 | 
			
		||||
    }
 | 
			
		||||
  return state_str;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const char *
 | 
			
		||||
pim_reg_state2brief_str (enum pim_reg_state reg_state, char *state_str)
 | 
			
		||||
{
 | 
			
		||||
  switch (reg_state)
 | 
			
		||||
    {
 | 
			
		||||
    case PIM_REG_NOINFO:
 | 
			
		||||
      strcpy (state_str, "RegNI");
 | 
			
		||||
      break;
 | 
			
		||||
    case PIM_REG_JOIN:
 | 
			
		||||
      strcpy (state_str, "RegJ");
 | 
			
		||||
      break;
 | 
			
		||||
    case PIM_REG_JOIN_PENDING:
 | 
			
		||||
    case PIM_REG_PRUNE:
 | 
			
		||||
      strcpy (state_str, "RegP");
 | 
			
		||||
      break;
 | 
			
		||||
    default:
 | 
			
		||||
      strcpy (state_str, "Unk");
 | 
			
		||||
    }
 | 
			
		||||
  return state_str;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void pim_show_upstream(struct vty *vty, u_char uj)
 | 
			
		||||
{
 | 
			
		||||
  struct listnode     *upnode;
 | 
			
		||||
@ -1691,10 +1729,13 @@ static void pim_show_upstream(struct vty *vty, u_char uj)
 | 
			
		||||
    pim_time_timer_to_hhmmss (ka_timer, sizeof (ka_timer), up->t_ka_timer);
 | 
			
		||||
    pim_time_timer_to_hhmmss (msdp_reg_timer, sizeof (msdp_reg_timer), up->t_msdp_reg_timer);
 | 
			
		||||
 | 
			
		||||
    if (pim_if_connected_to_source (up->rpf.source_nexthop.interface, up->sg.src))
 | 
			
		||||
      pim_reg_state2str (up->reg_state, state_str);
 | 
			
		||||
    else
 | 
			
		||||
      strcpy (state_str, pim_upstream_state2str (up->join_state));
 | 
			
		||||
    pim_upstream_state2brief_str (up->join_state, state_str);
 | 
			
		||||
    if (up->reg_state != PIM_REG_NOINFO) {
 | 
			
		||||
      char tmp_str[PIM_REG_STATE_STR_LEN];
 | 
			
		||||
 | 
			
		||||
      sprintf (state_str + strlen (state_str), ",%s",
 | 
			
		||||
               pim_reg_state2brief_str (up->reg_state, tmp_str));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (uj) {
 | 
			
		||||
      json_object_object_get_ex(json, grp_str, &json_group);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user