Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet In INADDR_TO_IA(), skip interfaces which are not...



details:   https://anonhg.NetBSD.org/src/rev/edf8ab6b875b
branches:  trunk
changeset: 472631:edf8ab6b875b
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon May 03 22:12:44 1999 +0000

description:
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.

diffstat:

 sys/netinet/in_var.h   |  8 ++++++--
 sys/netinet/ip_input.c |  8 +++-----
 2 files changed, 9 insertions(+), 7 deletions(-)

diffs (50 lines):

diff -r 3180276daa9c -r edf8ab6b875b sys/netinet/in_var.h
--- a/sys/netinet/in_var.h      Mon May 03 21:58:10 1999 +0000
+++ b/sys/netinet/in_var.h      Mon May 03 22:12:44 1999 +0000
@@ -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 @@
 /*
  * 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; \
 }
diff -r 3180276daa9c -r edf8ab6b875b sys/netinet/ip_input.c
--- a/sys/netinet/ip_input.c    Mon May 03 21:58:10 1999 +0000
+++ b/sys/netinet/ip_input.c    Mon May 03 22:12:44 1999 +0000
@@ -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 @@
         * 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) {



Home | Main Index | Thread Index | Old Index