summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>1997-02-22 13:25:29 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>1997-02-22 13:25:29 +0000
commit3ac5177da530b4207cec0b66ae2437cd2fd227ac (patch)
treec1512e1e352ebee827f2be2c0c68b2436156d1d8 /sys
parentead7abad6d7c3f7737c7975a93b779634dbb79b8 (diff)
Fixed problem in ip_weadvertise().
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/ip_input.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 41caa44001a..c0decb9a188 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_input.c,v 1.23 1997/02/22 05:56:48 angelos Exp $ */
+/* $OpenBSD: ip_input.c,v 1.24 1997/02/22 13:25:28 angelos Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/*
@@ -53,6 +53,7 @@
#include <sys/sysctl.h>
#include <net/if.h>
+#include <net/if_dl.h>
#include <net/route.h>
#include <netinet/in.h>
@@ -946,8 +947,10 @@ ip_weadvertise(addr)
u_int32_t addr;
{
register struct rtentry *rt;
+ register struct ifnet *ifp;
+ register struct ifaddr *ifa;
struct sockaddr_inarp sin;
-
+
sin.sin_len = sizeof(sin);
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = addr;
@@ -962,8 +965,17 @@ ip_weadvertise(addr)
|| rt->rt_gateway->sa_family != AF_LINK)
return 0;
- if(ifa_ifwithaddr(sintosa(&sin)))
- return 1;
+ for (ifp = ifnet.tqh_first; ifp != 0; ifp = ifp->if_list.tqe_next)
+ for (ifa = ifp->if_addrlist.tqh_first; ifa != 0; ifa = ifa->ifa_list.tqe_next)
+ {
+ if (ifa->ifa_addr->sa_family != rt->rt_gateway->sa_family)
+ continue;
+
+ if (!bcmp(LLADDR((struct sockaddr_dl *)ifa->ifa_addr),
+ LLADDR((struct sockaddr_dl *)rt->rt_gateway),
+ ETHER_ADDR_LEN))
+ return 1;
+ }
return 0;
}