Source-Changes-HG archive

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

[src/netbsd-1-4]: src/sys/net Pull up revision 1.62 (via patch, requested by ...



details:   https://anonhg.NetBSD.org/src/rev/6ff935e64a75
branches:  netbsd-1-4
changeset: 470536:6ff935e64a75
user:      he <he%NetBSD.org@localhost>
date:      Sun Apr 30 12:51:05 2000 +0000

description:
Pull up revision 1.62 (via patch, requested by bouyer):
  Fix ifa_ifwithnet() for the netatalk case to properly return the
  best match and not the first match.  Makes netatalk work again
  on networks without AppleTalk routers.  Fixes PR#9957.

diffstat:

 sys/net/if.c |  22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diffs (39 lines):

diff -r 40bbb2e17019 -r 6ff935e64a75 sys/net/if.c
--- a/sys/net/if.c      Sun Apr 30 12:45:07 2000 +0000
+++ b/sys/net/if.c      Sun Apr 30 12:51:05 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.48.2.1 1999/08/24 19:19:30 he Exp $   */
+/*     $NetBSD: if.c,v 1.48.2.2 2000/04/30 12:51:05 he Exp $   */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -211,14 +211,24 @@
        }
 #ifdef NETATALK
        if (af == AF_APPLETALK) {
+               struct sockaddr_at *sat, *sat2;
+
+               sat = (struct sockaddr_at*)addr;
                for (ifp = ifnet.tqh_first; ifp != 0;
                    ifp = ifp->if_list.tqe_next) {
-                       ifa = at_ifawithnet((struct sockaddr_at *)addr, ifp);
-                       if (ifa)
-                               return ifa;
+                       ifa = at_ifawithnet(sat, ifp);
+                       if (ifa == NULL)
+                               continue;
+                       sat2 = (struct sockaddr_at *)ifa->ifa_addr;
+                       if (sat2->sat_addr.s_net == sat->sat_addr.s_net)
+                               return (ifa); /* exact match */
+                       if (ifa_maybe == NULL) {
+                               /* else keep the if with the rigth range */
+                               ifa_maybe = ifa;
+                       }
                }
-               return NULL;
-       }
+               return (ifa_maybe);
+       }
 #endif
        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) {



Home | Main Index | Thread Index | Old Index