mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 11:30:30 +00:00
pimd: To print querierIP address on the querier and nonQuerier IGMP enabled intf
1. Add the querierIP object to igmp_sock datastruct to save the IP address of the querier. Management of the querierIP object is added. 2. To show the querier IP address in the CLI "show ip igmp interface". 3. To add the json object querierIP for querier IP address in the json CLI "show ip igmp interface json". Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
This commit is contained in:
parent
12536067cc
commit
9a7cee2673
@ -497,6 +497,7 @@ static void igmp_show_interfaces(struct pim_instance *pim, struct vty *vty,
|
|||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
time_t now;
|
time_t now;
|
||||||
char buf[PREFIX_STRLEN];
|
char buf[PREFIX_STRLEN];
|
||||||
|
char quer_buf[PREFIX_STRLEN];
|
||||||
json_object *json = NULL;
|
json_object *json = NULL;
|
||||||
json_object *json_row = NULL;
|
json_object *json_row = NULL;
|
||||||
|
|
||||||
@ -506,7 +507,7 @@ static void igmp_show_interfaces(struct pim_instance *pim, struct vty *vty,
|
|||||||
json = json_object_new_object();
|
json = json_object_new_object();
|
||||||
else
|
else
|
||||||
vty_out(vty,
|
vty_out(vty,
|
||||||
"Interface State Address V Querier Query Timer Uptime\n");
|
"Interface State Address V Querier QuerierIp Query Timer Uptime\n");
|
||||||
|
|
||||||
FOR_ALL_INTERFACES (pim->vrf, ifp) {
|
FOR_ALL_INTERFACES (pim->vrf, ifp) {
|
||||||
struct pim_interface *pim_ifp;
|
struct pim_interface *pim_ifp;
|
||||||
@ -544,6 +545,10 @@ static void igmp_show_interfaces(struct pim_instance *pim, struct vty *vty,
|
|||||||
"queryTimer",
|
"queryTimer",
|
||||||
query_hhmmss);
|
query_hhmmss);
|
||||||
}
|
}
|
||||||
|
json_object_string_add(
|
||||||
|
json_row, "querierIp",
|
||||||
|
inet_ntop(AF_INET, &igmp->querier_addr,
|
||||||
|
quer_buf, sizeof(quer_buf)));
|
||||||
|
|
||||||
json_object_object_add(json, ifp->name,
|
json_object_object_add(json, ifp->name,
|
||||||
json_row);
|
json_row);
|
||||||
@ -554,18 +559,19 @@ static void igmp_show_interfaces(struct pim_instance *pim, struct vty *vty,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
vty_out(vty,
|
vty_out(vty,
|
||||||
"%-16s %5s %15s %d %7s %11s %8s\n",
|
"%-16s %5s %15s %d %7s %17pI4 %11s %8s\n",
|
||||||
ifp->name,
|
ifp->name,
|
||||||
if_is_up(ifp)
|
if_is_up(ifp)
|
||||||
? (igmp->mtrace_only ? "mtrc"
|
? (igmp->mtrace_only ? "mtrc"
|
||||||
: "up")
|
: "up")
|
||||||
: "down",
|
: "down",
|
||||||
inet_ntop(AF_INET, &igmp->ifaddr,
|
inet_ntop(AF_INET, &igmp->ifaddr, buf,
|
||||||
buf, sizeof(buf)),
|
sizeof(buf)),
|
||||||
pim_ifp->igmp_version,
|
pim_ifp->igmp_version,
|
||||||
igmp->t_igmp_query_timer ? "local"
|
igmp->t_igmp_query_timer ? "local"
|
||||||
: "other",
|
: "other",
|
||||||
query_hhmmss, uptime);
|
&igmp->querier_addr, query_hhmmss,
|
||||||
|
uptime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -586,6 +592,7 @@ static void igmp_show_interfaces_single(struct pim_instance *pim,
|
|||||||
struct listnode *sock_node;
|
struct listnode *sock_node;
|
||||||
struct pim_interface *pim_ifp;
|
struct pim_interface *pim_ifp;
|
||||||
char uptime[10];
|
char uptime[10];
|
||||||
|
char quer_buf[PREFIX_STRLEN];
|
||||||
char query_hhmmss[10];
|
char query_hhmmss[10];
|
||||||
char other_hhmmss[10];
|
char other_hhmmss[10];
|
||||||
int found_ifname = 0;
|
int found_ifname = 0;
|
||||||
@ -670,6 +677,10 @@ static void igmp_show_interfaces_single(struct pim_instance *pim,
|
|||||||
igmp->t_igmp_query_timer
|
igmp->t_igmp_query_timer
|
||||||
? "local"
|
? "local"
|
||||||
: "other");
|
: "other");
|
||||||
|
json_object_string_add(
|
||||||
|
json_row, "querierIp",
|
||||||
|
inet_ntop(AF_INET, &igmp->querier_addr,
|
||||||
|
quer_buf, sizeof(quer_buf)));
|
||||||
json_object_int_add(json_row, "queryStartCount",
|
json_object_int_add(json_row, "queryStartCount",
|
||||||
igmp->startup_query_count);
|
igmp->startup_query_count);
|
||||||
json_object_string_add(json_row,
|
json_object_string_add(json_row,
|
||||||
@ -739,6 +750,14 @@ static void igmp_show_interfaces_single(struct pim_instance *pim,
|
|||||||
vty_out(vty, "Querier : %s\n",
|
vty_out(vty, "Querier : %s\n",
|
||||||
igmp->t_igmp_query_timer ? "local"
|
igmp->t_igmp_query_timer ? "local"
|
||||||
: "other");
|
: "other");
|
||||||
|
vty_out(vty, "QuerierIp : %pI4",
|
||||||
|
&igmp->querier_addr);
|
||||||
|
if (pim_ifp->primary_address.s_addr
|
||||||
|
== igmp->querier_addr.s_addr)
|
||||||
|
vty_out(vty, " (this router)\n");
|
||||||
|
else
|
||||||
|
vty_out(vty, "\n");
|
||||||
|
|
||||||
vty_out(vty, "Start Count : %d\n",
|
vty_out(vty, "Start Count : %d\n",
|
||||||
igmp->startup_query_count);
|
igmp->startup_query_count);
|
||||||
vty_out(vty, "Query Timer : %s\n",
|
vty_out(vty, "Query Timer : %s\n",
|
||||||
|
@ -167,6 +167,8 @@ static int pim_igmp_other_querier_expire(struct thread *t)
|
|||||||
sizeof(ifaddr_str));
|
sizeof(ifaddr_str));
|
||||||
zlog_debug("%s: Querier %s resuming", __func__, ifaddr_str);
|
zlog_debug("%s: Querier %s resuming", __func__, ifaddr_str);
|
||||||
}
|
}
|
||||||
|
/* Mark the interface address as querier address */
|
||||||
|
igmp->querier_addr = igmp->ifaddr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
We are the current querier, then
|
We are the current querier, then
|
||||||
@ -397,6 +399,8 @@ static int igmp_recv_query(struct igmp_sock *igmp, int query_version,
|
|||||||
ntohl(igmp->ifaddr.s_addr), from_str,
|
ntohl(igmp->ifaddr.s_addr), from_str,
|
||||||
ntohl(from.s_addr));
|
ntohl(from.s_addr));
|
||||||
}
|
}
|
||||||
|
if (ntohl(from.s_addr) < ntohl(igmp->querier_addr.s_addr))
|
||||||
|
igmp->querier_addr.s_addr = from.s_addr;
|
||||||
|
|
||||||
pim_igmp_other_querier_timer_on(igmp);
|
pim_igmp_other_querier_timer_on(igmp);
|
||||||
}
|
}
|
||||||
@ -935,6 +939,7 @@ static struct igmp_sock *igmp_sock_new(int fd, struct in_addr ifaddr,
|
|||||||
igmp->fd = fd;
|
igmp->fd = fd;
|
||||||
igmp->interface = ifp;
|
igmp->interface = ifp;
|
||||||
igmp->ifaddr = ifaddr;
|
igmp->ifaddr = ifaddr;
|
||||||
|
igmp->querier_addr = ifaddr;
|
||||||
igmp->t_igmp_read = NULL;
|
igmp->t_igmp_read = NULL;
|
||||||
igmp->t_igmp_query_timer = NULL;
|
igmp->t_igmp_query_timer = NULL;
|
||||||
igmp->t_other_querier_timer = NULL; /* no other querier present */
|
igmp->t_other_querier_timer = NULL; /* no other querier present */
|
||||||
|
@ -92,8 +92,8 @@ struct igmp_sock {
|
|||||||
struct thread
|
struct thread
|
||||||
*t_igmp_query_timer; /* timer: issue IGMP general queries */
|
*t_igmp_query_timer; /* timer: issue IGMP general queries */
|
||||||
struct thread *t_other_querier_timer; /* timer: other querier present */
|
struct thread *t_other_querier_timer; /* timer: other querier present */
|
||||||
|
struct in_addr querier_addr; /* IP address of the querier */
|
||||||
int querier_query_interval; /* QQI */
|
int querier_query_interval; /* QQI */
|
||||||
int querier_robustness_variable; /* QRV */
|
int querier_robustness_variable; /* QRV */
|
||||||
int startup_query_count;
|
int startup_query_count;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user