summaryrefslogtreecommitdiffstats
path: root/lib/libc/rpc/pmap_rmt.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/rpc/pmap_rmt.c')
-rw-r--r--lib/libc/rpc/pmap_rmt.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/libc/rpc/pmap_rmt.c b/lib/libc/rpc/pmap_rmt.c
index 8511206..4b907ab 100644
--- a/lib/libc/rpc/pmap_rmt.c
+++ b/lib/libc/rpc/pmap_rmt.c
@@ -30,7 +30,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro";*/
/*static char *sccsid = "from: @(#)pmap_rmt.c 2.2 88/08/01 4.0 RPCSRC";*/
-static char *rcsid = "$Id: pmap_rmt.c,v 1.3 1995/10/22 14:51:32 phk Exp $";
+static char *rcsid = "$Id: pmap_rmt.c,v 1.4 1995/12/07 12:50:55 bde Exp $";
#endif
/*
@@ -171,6 +171,7 @@ getbroadcastnets(addrs, sock, buf)
struct ifconf ifc;
struct ifreq ifreq, *ifr;
struct sockaddr_in *sin;
+ struct in_addr addr;
char *cp, *cplim;
int n, i = 0;
@@ -198,17 +199,24 @@ getbroadcastnets(addrs, sock, buf)
sin = (struct sockaddr_in *)&ifr->ifr_addr;
#ifdef SIOCGIFBRDADDR /* 4.3BSD */
if (ioctl(sock, SIOCGIFBRDADDR, (char *)&ifreq) < 0) {
- addrs[i++] =
+ addr =
inet_makeaddr(inet_netof(sin->sin_addr),
INADDR_ANY);
} else {
- addrs[i++] = ((struct sockaddr_in*)
+ addr = ((struct sockaddr_in*)
&ifreq.ifr_addr)->sin_addr;
}
#else /* 4.2 BSD */
- addrs[i++] = inet_makeaddr(inet_netof(sin->sin_addr),
+ addr = inet_makeaddr(inet_netof(sin->sin_addr),
INADDR_ANY);
#endif
+ for (n=i-1; n>=0; n--) {
+ if (addr.s_addr == addrs[n].s_addr)
+ break;
+ }
+ if (n<0) {
+ addrs[i++] = addr;
+ }
}
}
return (i);
OpenPOWER on IntegriCloud