summaryrefslogtreecommitdiffstats
path: root/sys/netinet6
diff options
context:
space:
mode:
authorluigi <luigi@FreeBSD.org>2004-04-25 09:24:52 +0000
committerluigi <luigi@FreeBSD.org>2004-04-25 09:24:52 +0000
commit59063f7a089ed07823309dc56641c8a847f21c23 (patch)
treeb64da6798f0d544a1f0a0369b5c8f192b6c31e34 /sys/netinet6
parent6430766c7e3512aa8239ab4ffe30ab8faa9dfe7d (diff)
downloadFreeBSD-src-59063f7a089ed07823309dc56641c8a847f21c23.zip
FreeBSD-src-59063f7a089ed07823309dc56641c8a847f21c23.tar.gz
This commit does two things:
1. rt_check() cleanup: rt_check() is only necessary for some address families to gain access to the corresponding arp entry, so call it only in/near the *resolve() routines where it is actually used -- at the moment this is arpresolve(), nd6_storelladdr() (the call is embedded here), and atmresolve() (the call is just before atmresolve to reduce the number of changes). This change will make it a lot easier to decouple the arp table from the routing table. There is an extra call to rt_check() in if_iso88025subr.c to determine the routing info length. I have left it alone for the time being. The interface of arpresolve() and nd6_storelladdr() now changes slightly: + the 'rtentry' parameter (really a hint from the upper level layer) is now passed unchanged from *_output(), so it becomes the route to the final destination and not to the gateway. + the routines will return 0 if resolution is possible, non-zero otherwise. + arpresolve() returns EWOULDBLOCK in case the mbuf is being held waiting for an arp reply -- in this case the error code is masked in the caller so the upper layer protocol will not see a failure. 2. arpcom untangling Where possible, use 'struct ifnet' instead of 'struct arpcom' variables, and use the IFP2AC macro to access arpcom fields. This mostly affects the netatalk code. === Detailed changes: === net/if_arcsubr.c rt_check() cleanup, remove a useless variable net/if_atmsubr.c rt_check() cleanup net/if_ethersubr.c rt_check() cleanup, arpcom untangling net/if_fddisubr.c rt_check() cleanup, arpcom untangling net/if_iso88025subr.c rt_check() cleanup netatalk/aarp.c arpcom untangling, remove a block of duplicated code netatalk/at_extern.h arpcom untangling netinet/if_ether.c rt_check() cleanup (change arpresolve) netinet6/nd6.c rt_check() cleanup (change nd6_storelladdr)
Diffstat (limited to 'sys/netinet6')
-rw-r--r--sys/netinet6/nd6.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index d907505..4523f53 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -2032,15 +2032,16 @@ nd6_need_cache(ifp)
}
int
-nd6_storelladdr(ifp, rt, m, dst, desten)
+nd6_storelladdr(ifp, rt0, m, dst, desten)
struct ifnet *ifp;
- struct rtentry *rt;
+ struct rtentry *rt0;
struct mbuf *m;
struct sockaddr *dst;
u_char *desten;
{
int i;
struct sockaddr_dl *sdl;
+ struct rtentry *rt;
if (m->m_flags & M_MCAST) {
switch (ifp->if_type) {
@@ -2073,26 +2074,32 @@ nd6_storelladdr(ifp, rt, m, dst, desten)
}
}
+ i = rt_check(&rt, &rt0, dst);
+ if (i) {
+ m_freem(m);
+ return i;
+ }
+
if (rt == NULL) {
/* this could happen, if we could not allocate memory */
m_freem(m);
- return (0);
+ return (ENOMEM);
}
if (rt->rt_gateway->sa_family != AF_LINK) {
printf("nd6_storelladdr: something odd happens\n");
m_freem(m);
- return (0);
+ return (EINVAL);
}
sdl = SDL(rt->rt_gateway);
if (sdl->sdl_alen == 0) {
/* this should be impossible, but we bark here for debugging */
printf("nd6_storelladdr: sdl_alen == 0\n");
m_freem(m);
- return (0);
+ return (EINVAL);
}
bcopy(LLADDR(sdl), desten, sdl->sdl_alen);
- return (1);
+ return (0);
}
static int nd6_sysctl_drlist(SYSCTL_HANDLER_ARGS);
OpenPOWER on IntegriCloud