Changeset View
Changeset View
Standalone View
Standalone View
head/sys/net/if_arcsubr.c
Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | |||||
arc_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, | arc_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, | ||||
struct route *ro) | struct route *ro) | ||||
{ | { | ||||
struct arc_header *ah; | struct arc_header *ah; | ||||
int error; | int error; | ||||
u_int8_t atype, adst; | u_int8_t atype, adst; | ||||
int loop_copy = 0; | int loop_copy = 0; | ||||
int isphds; | int isphds; | ||||
#ifdef INET | #if defined(INET) || defined(INET6) | ||||
int is_gw; | int is_gw = 0; | ||||
#endif | #endif | ||||
if (!((ifp->if_flags & IFF_UP) && | if (!((ifp->if_flags & IFF_UP) && | ||||
(ifp->if_drv_flags & IFF_DRV_RUNNING))) | (ifp->if_drv_flags & IFF_DRV_RUNNING))) | ||||
return(ENETDOWN); /* m, m1 aren't initialized yet */ | return(ENETDOWN); /* m, m1 aren't initialized yet */ | ||||
error = 0; | error = 0; | ||||
#if defined(INET) || defined(INET6) | |||||
if (ro != NULL && ro->ro_rt != NULL && | |||||
(ro->ro_rt->rt_flags & RTF_GATEWAY) != 0) | |||||
is_gw = 1; | |||||
#endif | |||||
switch (dst->sa_family) { | switch (dst->sa_family) { | ||||
#ifdef INET | #ifdef INET | ||||
case AF_INET: | case AF_INET: | ||||
/* | /* | ||||
* For now, use the simple IP addr -> ARCnet addr mapping | * For now, use the simple IP addr -> ARCnet addr mapping | ||||
*/ | */ | ||||
if (m->m_flags & (M_BCAST|M_MCAST)) | if (m->m_flags & (M_BCAST|M_MCAST)) | ||||
adst = arcbroadcastaddr; /* ARCnet broadcast address */ | adst = arcbroadcastaddr; /* ARCnet broadcast address */ | ||||
else if (ifp->if_flags & IFF_NOARP) | else if (ifp->if_flags & IFF_NOARP) | ||||
adst = ntohl(SIN(dst)->sin_addr.s_addr) & 0xFF; | adst = ntohl(SIN(dst)->sin_addr.s_addr) & 0xFF; | ||||
else { | else { | ||||
is_gw = 0; | |||||
if (ro != NULL && ro->ro_rt != NULL && | |||||
(ro->ro_rt->rt_flags & RTF_GATEWAY) != 0) | |||||
is_gw = 1; | |||||
error = arpresolve(ifp, is_gw, m, dst, &adst, NULL); | error = arpresolve(ifp, is_gw, m, dst, &adst, NULL); | ||||
if (error) | if (error) | ||||
return (error == EWOULDBLOCK ? 0 : error); | return (error == EWOULDBLOCK ? 0 : error); | ||||
} | } | ||||
atype = (ifp->if_flags & IFF_LINK0) ? | atype = (ifp->if_flags & IFF_LINK0) ? | ||||
ARCTYPE_IP_OLD : ARCTYPE_IP; | ARCTYPE_IP_OLD : ARCTYPE_IP; | ||||
break; | break; | ||||
Show All 24 Lines | #ifdef INET | ||||
} | } | ||||
break; | break; | ||||
#endif | #endif | ||||
#ifdef INET6 | #ifdef INET6 | ||||
case AF_INET6: | case AF_INET6: | ||||
if ((m->m_flags & M_MCAST) != 0) | if ((m->m_flags & M_MCAST) != 0) | ||||
adst = arcbroadcastaddr; /* ARCnet broadcast address */ | adst = arcbroadcastaddr; /* ARCnet broadcast address */ | ||||
else | else { | ||||
error = nd6_storelladdr(ifp, m, dst, (u_char *)&adst, NULL); | error = nd6_resolve(ifp, is_gw, m, dst, &adst, NULL); | ||||
if (error) | if (error != 0) | ||||
return (error); | return (error == EWOULDBLOCK ? 0 : error); | ||||
} | |||||
atype = ARCTYPE_INET6; | atype = ARCTYPE_INET6; | ||||
break; | break; | ||||
#endif | #endif | ||||
case AF_UNSPEC: | case AF_UNSPEC: | ||||
{ | { | ||||
const struct arc_header *ah; | const struct arc_header *ah; | ||||
loop_copy = -1; | loop_copy = -1; | ||||
▲ Show 20 Lines • Show All 652 Lines • Show Last 20 Lines |