aboutsummaryrefslogtreecommitdiff
path: root/sys/net/if_iso88025subr.c
diff options
context:
space:
mode:
authorLuigi Rizzo <luigi@FreeBSD.org>2004-04-25 09:24:52 +0000
committerLuigi Rizzo <luigi@FreeBSD.org>2004-04-25 09:24:52 +0000
commitcd46a114fcb92154fdcee571daa45037a2aaf36f (patch)
treeb64da6798f0d544a1f0a0369b5c8f192b6c31e34 /sys/net/if_iso88025subr.c
parent8cd65c072e75ffa813dd84cf610cc0b8d095e5d4 (diff)
downloadsrc-cd46a114fcb92154fdcee571daa45037a2aaf36f.tar.gz
src-cd46a114fcb92154fdcee571daa45037a2aaf36f.zip
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)
Notes
Notes: svn path=/head/; revision=128636
Diffstat (limited to 'sys/net/if_iso88025subr.c')
-rw-r--r--sys/net/if_iso88025subr.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/net/if_iso88025subr.c b/sys/net/if_iso88025subr.c
index 72b246f84f86..a34f92903af0 100644
--- a/sys/net/if_iso88025subr.c
+++ b/sys/net/if_iso88025subr.c
@@ -259,11 +259,12 @@ iso88025_output(ifp, m, dst, rt0)
senderr(ENETDOWN);
getmicrotime(&ifp->if_lastchange);
+ /* Calculate routing info length based on arp table entry */
+ /* XXX any better way to do this ? */
error = rt_check(&rt, &rt0, dst);
if (error)
goto bad;
- /* Calculate routing info length based on arp table entry */
if (rt && (sdl = (struct sockaddr_dl *)rt->rt_gateway))
if (SDL_ISO88025(sdl)->trld_rcf != 0)
rif_len = TR_RCF_RIFLEN(SDL_ISO88025(sdl)->trld_rcf);
@@ -286,8 +287,9 @@ iso88025_output(ifp, m, dst, rt0)
switch (dst->sa_family) {
#ifdef INET
case AF_INET:
- if (!arpresolve(ifp, rt, m, dst, edst))
- return (0); /* if not yet resolved */
+ error = arpresolve(ifp, rt0, m, dst, edst);
+ if (error)
+ return (error == EWOULDBLOCK ? 0 : error);
snap_type = ETHERTYPE_IP;
break;
case AF_ARP:
@@ -320,10 +322,9 @@ iso88025_output(ifp, m, dst, rt0)
#endif /* INET */
#ifdef INET6
case AF_INET6:
- if (!nd6_storelladdr(ifp, rt, m, dst, (u_char *)edst)) {
- /* Something bad happened */
- return(0);
- }
+ error = nd6_storelladdr(ifp, rt0, m, dst, (u_char *)edst);
+ if (error)
+ return (error);
snap_type = ETHERTYPE_IPV6;
break;
#endif /* INET6 */