Fix ifa_ifwithnet() for the netatalk case: netatalk uses blocks of addresses

which can't be handled by netmask, and ifa_ifwithnet() didn't find the
interface associated with an adress if it was in the same block but not with
the same prefix. This prevented 'route add' and atalkd to work properly
with some network configs.
This has been discussed on tech-net some weeks ago.
This commit is contained in:
bouyer 1999-08-24 16:02:27 +00:00
parent 28602510ee
commit 075ea2cfea

View File

@ -1,4 +1,4 @@
/* $NetBSD: if.c,v 1.50 1999/07/09 23:41:16 thorpej Exp $ */
/* $NetBSD: if.c,v 1.51 1999/08/24 16:02:27 bouyer Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -69,6 +69,7 @@
#include "opt_compat_linux.h"
#include "opt_compat_svr4.h"
#include "opt_compat_43.h"
#include "opt_atalk.h"
#include <sys/param.h>
#include <sys/mbuf.h>
@ -84,6 +85,10 @@
#include <net/if_dl.h>
#include <net/if_types.h>
#include <net/radix.h>
#ifdef NETATALK
#include <netatalk/at_extern.h>
#include <netatalk/at.h>
#endif
#ifdef INET6
/*XXX*/
@ -279,6 +284,17 @@ ifa_ifwithnet(addr)
if (sdl->sdl_index && sdl->sdl_index <= if_index)
return (ifnet_addrs[sdl->sdl_index]);
}
#ifdef NETATALK
if (af == AF_APPLETALK) {
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;
}
return NULL;
}
#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) {
register char *cp, *cp2, *cp3;