pimd: drop printing IP_MULTICAST_LOOP sockopt

This isn't a system or interface setting, it's a socket behavior.  It is
both irrelevant and confusing to the user since it doesn't affect any
system behavior (but it sounds like it does).  Whether it is enabled or
not is solely relevant to how the code is designed to work.

So, remove it from output.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
David Lamparter 2022-03-12 12:52:34 +01:00
parent 82aca4ae4f
commit c532e50351
3 changed files with 3 additions and 37 deletions

View File

@ -455,8 +455,7 @@ static void pim_show_membership(struct pim_instance *pim, struct vty *vty,
json_object_free(json); json_object_free(json);
} }
static void pim_print_ifp_flags(struct vty *vty, struct interface *ifp, static void pim_print_ifp_flags(struct vty *vty, struct interface *ifp)
int mloop)
{ {
vty_out(vty, "Flags\n"); vty_out(vty, "Flags\n");
vty_out(vty, "-----\n"); vty_out(vty, "-----\n");
@ -469,7 +468,6 @@ static void pim_print_ifp_flags(struct vty *vty, struct interface *ifp,
vty_out(vty, "Interface Index : %d\n", ifp->ifindex); vty_out(vty, "Interface Index : %d\n", ifp->ifindex);
vty_out(vty, "Multicast : %s\n", vty_out(vty, "Multicast : %s\n",
if_is_multicast(ifp) ? "yes" : "no"); if_is_multicast(ifp) ? "yes" : "no");
vty_out(vty, "Multicast Loop : %d\n", mloop);
vty_out(vty, "Promiscuous : %s\n", vty_out(vty, "Promiscuous : %s\n",
(ifp->flags & IFF_PROMISC) ? "yes" : "no"); (ifp->flags & IFF_PROMISC) ? "yes" : "no");
vty_out(vty, "\n"); vty_out(vty, "\n");
@ -576,7 +574,6 @@ static void igmp_show_interfaces_single(struct pim_instance *pim,
char other_hhmmss[10]; char other_hhmmss[10];
int found_ifname = 0; int found_ifname = 0;
int sqi; int sqi;
int mloop = 0;
long gmi_msec; /* Group Membership Interval */ long gmi_msec; /* Group Membership Interval */
long lmqt_msec; long lmqt_msec;
long ohpi_msec; long ohpi_msec;
@ -639,11 +636,6 @@ static void igmp_show_interfaces_single(struct pim_instance *pim,
qri_msec = qri_msec =
pim_ifp->gm_query_max_response_time_dsec * 100; pim_ifp->gm_query_max_response_time_dsec * 100;
if (pim_ifp->pim_sock_fd >= 0)
mloop = pim_socket_mcastloop_get(
pim_ifp->pim_sock_fd);
else
mloop = 0;
lmqc = pim_ifp->gm_last_member_query_count; lmqc = pim_ifp->gm_last_member_query_count;
if (uj) { if (uj) {
@ -776,7 +768,7 @@ static void igmp_show_interfaces_single(struct pim_instance *pim,
vty_out(vty, "\n"); vty_out(vty, "\n");
vty_out(vty, "\n"); vty_out(vty, "\n");
pim_print_ifp_flags(vty, ifp, mloop); pim_print_ifp_flags(vty, ifp);
} }
} }
} }
@ -903,7 +895,6 @@ static void pim_show_interfaces_single(struct pim_instance *pim,
char src_str[INET_ADDRSTRLEN]; char src_str[INET_ADDRSTRLEN];
char stat_uptime[10]; char stat_uptime[10];
char uptime[10]; char uptime[10];
int mloop = 0;
int found_ifname = 0; int found_ifname = 0;
int print_header; int print_header;
json_object *json = NULL; json_object *json = NULL;
@ -945,10 +936,6 @@ static void pim_show_interfaces_single(struct pim_instance *pim,
pim_ifp->pim_hello_period); pim_ifp->pim_hello_period);
pim_time_uptime(stat_uptime, sizeof(stat_uptime), pim_time_uptime(stat_uptime, sizeof(stat_uptime),
now - pim_ifp->pim_ifstat_start); now - pim_ifp->pim_ifstat_start);
if (pim_ifp->pim_sock_fd >= 0)
mloop = pim_socket_mcastloop_get(pim_ifp->pim_sock_fd);
else
mloop = 0;
if (uj) { if (uj) {
char pbuf[PREFIX2STR_BUFFER]; char pbuf[PREFIX2STR_BUFFER];
@ -1096,8 +1083,6 @@ static void pim_show_interfaces_single(struct pim_instance *pim,
pim_ifp->pim_ifstat_hello_sendfail); pim_ifp->pim_ifstat_hello_sendfail);
json_object_int_add(json_row, "helloGenerationId", json_object_int_add(json_row, "helloGenerationId",
pim_ifp->pim_generation_id); pim_ifp->pim_generation_id);
json_object_int_add(json_row, "flagMulticastLoop",
mloop);
json_object_int_add( json_object_int_add(
json_row, "effectivePropagationDelay", json_row, "effectivePropagationDelay",
@ -1250,7 +1235,7 @@ static void pim_show_interfaces_single(struct pim_instance *pim,
vty_out(vty, "\n"); vty_out(vty, "\n");
vty_out(vty, "\n"); vty_out(vty, "\n");
pim_print_ifp_flags(vty, ifp, mloop); pim_print_ifp_flags(vty, ifp);
vty_out(vty, "Join Prune Interval\n"); vty_out(vty, "Join Prune Interval\n");
vty_out(vty, "-------------------\n"); vty_out(vty, "-------------------\n");

View File

@ -407,23 +407,6 @@ int pim_socket_recvfromto(int fd, uint8_t *buf, size_t len,
return err; /* len */ return err; /* len */
} }
int pim_socket_mcastloop_get(int fd)
{
int loop;
socklen_t loop_len = sizeof(loop);
if (getsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, &loop, &loop_len)) {
int e = errno;
zlog_warn(
"Could not get Multicast Loopback Option on socket fd=%d: errno=%d: %s",
fd, errno, safe_strerror(errno));
errno = e;
return PIM_SOCK_ERR_LOOP;
}
return loop;
}
int pim_socket_getsockname(int fd, struct sockaddr *name, socklen_t *namelen) int pim_socket_getsockname(int fd, struct sockaddr *name, socklen_t *namelen)
{ {
if (getsockname(fd, name, namelen)) { if (getsockname(fd, name, namelen)) {

View File

@ -47,8 +47,6 @@ int pim_socket_recvfromto(int fd, uint8_t *buf, size_t len,
struct sockaddr_in *to, socklen_t *tolen, struct sockaddr_in *to, socklen_t *tolen,
ifindex_t *ifindex); ifindex_t *ifindex);
int pim_socket_mcastloop_get(int fd);
int pim_socket_getsockname(int fd, struct sockaddr *name, socklen_t *namelen); int pim_socket_getsockname(int fd, struct sockaddr *name, socklen_t *namelen);
#endif /* PIM_SOCK_H */ #endif /* PIM_SOCK_H */