In INADDR_TO_IA(), skip interfaces which are not up. Revert previous change

to ip_input.c to check the interface status after INADDR_TO_IA().

Fix cooked up by Heiko Rupp and myself.

Fixes PR 7480.
This commit is contained in:
thorpej 1999-05-03 22:12:44 +00:00
parent 06d4645b5d
commit a40dff106e
2 changed files with 9 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: in_var.h,v 1.32 1998/12/19 02:46:12 thorpej Exp $ */
/* $NetBSD: in_var.h,v 1.33 1999/05/03 22:12:45 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -144,13 +144,17 @@ void in_socktrim __P((struct sockaddr_in *));
/*
* Macro for finding whether an internet address (in_addr) belongs to one
* of our interfaces (in_ifaddr). NULL if the address isn't ours.
*
* Note that even if we find an interface with the address we're looking
* for, we should skip that interface if it is not up.
*/
#define INADDR_TO_IA(addr, ia) \
/* struct in_addr addr; */ \
/* struct in_ifaddr *ia; */ \
{ \
for (ia = IN_IFADDR_HASH((addr).s_addr).lh_first; \
ia != NULL && !in_hosteq(ia->ia_addr.sin_addr, (addr)); \
ia != NULL && !in_hosteq(ia->ia_addr.sin_addr, (addr)) && \
(ia->ia_ifp->if_flags & IFF_UP) == 0; \
ia = ia->ia_hash.le_next) \
continue; \
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_input.c,v 1.85 1999/05/03 21:14:47 hwr Exp $ */
/* $NetBSD: ip_input.c,v 1.86 1999/05/03 22:12:44 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -428,10 +428,8 @@ next:
* Check our list of addresses, to see if the packet is for us.
*/
INADDR_TO_IA(ip->ip_dst, ia);
if (ia != NULL) {
if (ia->ia_ifp->if_flags & IFF_UP)
goto ours;
}
if (ia != NULL)
goto ours;
if (m->m_pkthdr.rcvif->if_flags & IFF_BROADCAST) {
for (ifa = m->m_pkthdr.rcvif->if_addrlist.tqh_first;
ifa != NULL; ifa = ifa->ifa_list.tqe_next) {