mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-11 17:04:19 +01:00
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:
parent
635d02db6f
commit
d1b44182d0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=14659
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user