Subject: Re: kern/7480
To: None <gnats-bugs@netbsd.org>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-net
Date: 05/03/1999 15:01:47
On Mon, 03 May 1999 14:56:35 -0700 
 Jason Thorpe <thorpej@nas.nasa.gov> wrote:

 > This patch should go in ASAP, and be pulled up onto the release branch.

ack, nevermind... this patch has a bug in it... I booted the wrong kernel
when I tested it.

Note the obvious typo in the added for() termination clause...

 > Index: in_var.h
 > ===================================================================
 > RCS file: /cvsroot/src/sys/netinet/in_var.h,v
 > retrieving revision 1.32
 > diff -c -r1.32 in_var.h
 > *** in_var.h	1998/12/19 02:46:12	1.32
 > --- in_var.h	1999/05/03 21:46:42
 > ***************
 > *** 144,156 ****
 >   /*
 >    * Macro for finding whether an internet address (in_addr) belongs to one
 >    * of our interfaces (in_ifaddr).  NULL if the address isn't ours.
 >    */
 >   #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 = ia->ia_hash.le_next) \
 >   		 continue; \
 >   }
 > --- 144,160 ----
 >   /*
 >    * 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->ia_ifp->if_flags & IFF_UP) != 0; \
 >   	    ia = ia->ia_hash.le_next) \
 >   		 continue; \
 >   }
 > Index: ip_input.c
 > ===================================================================
 > RCS file: /cvsroot/src/sys/netinet/ip_input.c,v
 > retrieving revision 1.84
 > diff -c -r1.84 ip_input.c
 > *** ip_input.c	1999/04/07 05:34:32	1.84
 > --- ip_input.c	1999/05/03 21:46:43
 > ***************
 > *** 419,428 ****
 >   	 * 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 (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) {
 > --- 419,426 ----
 >   	 * Check our list of addresses, to see if the packet is for us.
 >   	 */
 >   	INADDR_TO_IA(ip->ip_dst, ia);
 > ! 	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) {

        -- Jason R. Thorpe <thorpej@nas.nasa.gov>