diff options
author | github login name <ranjany@vmware.com> | 2021-07-05 18:24:19 +0200 |
---|---|---|
committer | github login name <ranjany@vmware.com> | 2021-07-06 09:14:28 +0200 |
commit | 9a7cee267329da1914c7f7efe1c450e78c28a9d7 (patch) | |
tree | 7ecc33978952f0ddf7531ed8725c0e046098ebb2 | |
parent | Merge pull request #8979 from opensourcerouting/msdp-topotest-speedup (diff) | |
download | frr-9a7cee267329da1914c7f7efe1c450e78c28a9d7.tar.xz frr-9a7cee267329da1914c7f7efe1c450e78c28a9d7.zip |
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>
-rw-r--r-- | pimd/pim_cmd.c | 37 | ||||
-rw-r--r-- | pimd/pim_igmp.c | 5 | ||||
-rw-r--r-- | pimd/pim_igmp.h | 4 |
3 files changed, 35 insertions, 11 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index cc11a3cc1..a0f4fd0b2 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -497,6 +497,7 @@ static void igmp_show_interfaces(struct pim_instance *pim, struct vty *vty, struct interface *ifp; time_t now; char buf[PREFIX_STRLEN]; + char quer_buf[PREFIX_STRLEN]; json_object *json = 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(); else 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) { struct pim_interface *pim_ifp; @@ -544,6 +545,10 @@ static void igmp_show_interfaces(struct pim_instance *pim, struct vty *vty, "queryTimer", 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_row); @@ -554,18 +559,19 @@ static void igmp_show_interfaces(struct pim_instance *pim, struct vty *vty, } } else { vty_out(vty, - "%-16s %5s %15s %d %7s %11s %8s\n", + "%-16s %5s %15s %d %7s %17pI4 %11s %8s\n", ifp->name, if_is_up(ifp) - ? (igmp->mtrace_only ? "mtrc" - : "up") - : "down", - inet_ntop(AF_INET, &igmp->ifaddr, - buf, sizeof(buf)), + ? (igmp->mtrace_only ? "mtrc" + : "up") + : "down", + inet_ntop(AF_INET, &igmp->ifaddr, buf, + sizeof(buf)), pim_ifp->igmp_version, igmp->t_igmp_query_timer ? "local" - : "other", - query_hhmmss, uptime); + : "other", + &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 pim_interface *pim_ifp; char uptime[10]; + char quer_buf[PREFIX_STRLEN]; char query_hhmmss[10]; char other_hhmmss[10]; int found_ifname = 0; @@ -670,6 +677,10 @@ static void igmp_show_interfaces_single(struct pim_instance *pim, igmp->t_igmp_query_timer ? "local" : "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", igmp->startup_query_count); 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", igmp->t_igmp_query_timer ? "local" : "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", igmp->startup_query_count); vty_out(vty, "Query Timer : %s\n", diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c index 73dcdbddb..d09d67ab0 100644 --- a/pimd/pim_igmp.c +++ b/pimd/pim_igmp.c @@ -167,6 +167,8 @@ static int pim_igmp_other_querier_expire(struct thread *t) sizeof(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 @@ -397,6 +399,8 @@ static int igmp_recv_query(struct igmp_sock *igmp, int query_version, ntohl(igmp->ifaddr.s_addr), from_str, 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); } @@ -935,6 +939,7 @@ static struct igmp_sock *igmp_sock_new(int fd, struct in_addr ifaddr, igmp->fd = fd; igmp->interface = ifp; igmp->ifaddr = ifaddr; + igmp->querier_addr = ifaddr; igmp->t_igmp_read = NULL; igmp->t_igmp_query_timer = NULL; igmp->t_other_querier_timer = NULL; /* no other querier present */ diff --git a/pimd/pim_igmp.h b/pimd/pim_igmp.h index a0681128c..2014f5a1c 100644 --- a/pimd/pim_igmp.h +++ b/pimd/pim_igmp.h @@ -92,8 +92,8 @@ struct igmp_sock { struct thread *t_igmp_query_timer; /* timer: issue IGMP general queries */ struct thread *t_other_querier_timer; /* timer: other querier present */ - - int querier_query_interval; /* QQI */ + struct in_addr querier_addr; /* IP address of the querier */ + int querier_query_interval; /* QQI */ int querier_robustness_variable; /* QRV */ int startup_query_count; |