From d6aa35eb561a7a1ed4eefd8d8c907af890b51f05 Mon Sep 17 00:00:00 2001 From: angelos Date: Sat, 22 Feb 1997 13:25:28 +0000 Subject: [PATCH] Fixed problem in ip_weadvertise(). --- sys/netinet/ip_input.c | 20 ++++++++++++++++---- 1 file 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 #include +#include #include #include @@ -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; } -- 2.20.1