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.
This commit is contained in:
Guido van Rooij 1996-03-17 20:12:53 +00:00
parent 635d02db6f
commit d1b44182d0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=14659

View File

@ -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);