diff options
author | guido <guido@FreeBSD.org> | 1996-03-17 20:12:53 +0000 |
---|---|---|
committer | guido <guido@FreeBSD.org> | 1996-03-17 20:12:53 +0000 |
commit | 7a8ec4f7ff2dea03c98fba486a0b2d2cfb854d0e (patch) | |
tree | b9f9b1f568c38aa1d369f6d94688caa5f9e0e04e /lib | |
parent | f319c01b19eff1a6881e6dbe2936755f747a0e9b (diff) | |
download | FreeBSD-src-7a8ec4f7ff2dea03c98fba486a0b2d2cfb854d0e.zip FreeBSD-src-7a8ec4f7ff2dea03c98fba486a0b2d2cfb854d0e.tar.gz |
Work around a bug in the Sun rpc code. This fixes a problem where
a machine with aliase ip addresses on the same subnet of an
interfaces' `real' ip addresses would generate <n> duplicate
broadcasts in clnt_broadcast().
Basically, this fix does a purge on the list of bradcast addresses.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/rpc/pmap_rmt.c | 16 |
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); |