diff options
Diffstat (limited to 'lib/libc/rpc/clnt_bcast.c')
-rw-r--r-- | lib/libc/rpc/clnt_bcast.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/libc/rpc/clnt_bcast.c b/lib/libc/rpc/clnt_bcast.c index 03fdf61d..d827820 100644 --- a/lib/libc/rpc/clnt_bcast.c +++ b/lib/libc/rpc/clnt_bcast.c @@ -149,28 +149,25 @@ __rpc_getbroadifs(int af, int proto, int socktype, broadlist_t *list) if (ifap->ifa_addr->sa_family != af || !(ifap->ifa_flags & IFF_UP)) continue; -#ifdef INET6 - if ((af == AF_INET6 && !(ifap->ifa_flags & IFF_MULTICAST)) || - !(ifap->ifa_flags & IFF_BROADCAST)) - continue; -#endif bip = (struct broadif *)malloc(sizeof *bip); if (bip == NULL) break; bip->index = if_nametoindex(ifap->ifa_name); + if ( #ifdef INET6 - if (af != AF_INET6 && (ifap->ifa_flags & IFF_BROADCAST)) { -#else - if (ifap->ifa_flags & IFF_BROADCAST) { + af != AF_INET6 && #endif + (ifap->ifa_flags & IFF_BROADCAST) && + ifap->ifa_broadaddr) { memcpy(&bip->broadaddr, ifap->ifa_broadaddr, (size_t)ifap->ifa_broadaddr->sa_len); sin = (struct sockaddr_in *)(void *)&bip->broadaddr; sin->sin_port = ((struct sockaddr_in *) (void *)res->ai_addr)->sin_port; + } else #ifdef INET6 - } else if (af == AF_INET6) { + if (af == AF_INET6 && (ifap->ifa_flags & IFF_MULTICAST)) { sin6 = (struct sockaddr_in6 *)(void *)&bip->broadaddr; inet_pton(af, RPCB_MULTICAST_ADDR, &sin6->sin6_addr); sin6->sin6_family = af; @@ -179,7 +176,11 @@ __rpc_getbroadifs(int af, int proto, int socktype, broadlist_t *list) ((struct sockaddr_in6 *) (void *)res->ai_addr)->sin6_port; sin6->sin6_scope_id = bip->index; + } else #endif + { + free(bip); + continue; } TAILQ_INSERT_TAIL(list, bip, link); count++; |