Changeset View
Changeset View
Standalone View
Standalone View
sys/net/if_fwsubr.c
Show First 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | firewire_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, | ||||
uint8_t speed; | uint8_t speed; | ||||
uint16_t psize, fsize, dsize; | uint16_t psize, fsize, dsize; | ||||
struct mbuf *mtail; | struct mbuf *mtail; | ||||
int unicast, dgl, foff; | int unicast, dgl, foff; | ||||
static int next_dgl; | static int next_dgl; | ||||
#if defined(INET) || defined(INET6) | #if defined(INET) || defined(INET6) | ||||
int is_gw = 0; | int is_gw = 0; | ||||
#endif | #endif | ||||
int af = RO_GET_FAMILY(ro, dst); | |||||
#ifdef MAC | #ifdef MAC | ||||
error = mac_ifnet_check_transmit(ifp, m); | error = mac_ifnet_check_transmit(ifp, m); | ||||
if (error) | if (error) | ||||
goto bad; | goto bad; | ||||
#endif | #endif | ||||
if (!((ifp->if_flags & IFF_UP) && | if (!((ifp->if_flags & IFF_UP) && | ||||
Show All 27 Lines | if (!mtag) { | ||||
} | } | ||||
m_tag_prepend(m, mtag); | m_tag_prepend(m, mtag); | ||||
} | } | ||||
destfw = (struct fw_hwaddr *)(mtag + 1); | destfw = (struct fw_hwaddr *)(mtag + 1); | ||||
} else { | } else { | ||||
destfw = NULL; | destfw = NULL; | ||||
} | } | ||||
switch (af) { | |||||
#ifdef INET | |||||
case AF_INET: | |||||
type = ETHERTYPE_IP; | |||||
break; | |||||
case AF_ARP: | |||||
type = ETHERTYPE_ARP; | |||||
break; | |||||
#endif | |||||
#ifdef INET6 | |||||
case AF_INET6: | |||||
type = ETHERTYPE_IPV6; | |||||
break; | |||||
#endif | |||||
default: | |||||
if_printf(ifp, "can't handle af%d\n", af); | |||||
error = EAFNOSUPPORT; | |||||
goto bad; | |||||
} | |||||
switch (dst->sa_family) { | switch (dst->sa_family) { | ||||
#ifdef INET | #ifdef INET | ||||
case AF_INET: | case AF_INET: | ||||
/* | /* | ||||
* Only bother with arp for unicast. Allocation of | * Only bother with arp for unicast. Allocation of | ||||
* channels etc. for firewire is quite different and | * channels etc. for firewire is quite different and | ||||
* doesn't fit into the arp model. | * doesn't fit into the arp model. | ||||
*/ | */ | ||||
if (unicast) { | if (unicast) { | ||||
error = arpresolve(ifp, is_gw, m, dst, | error = arpresolve(ifp, is_gw, m, dst, | ||||
(u_char *) destfw, NULL, NULL); | (u_char *) destfw, NULL, NULL); | ||||
if (error) | if (error) | ||||
return (error == EWOULDBLOCK ? 0 : error); | return (error == EWOULDBLOCK ? 0 : error); | ||||
} | } | ||||
type = ETHERTYPE_IP; | |||||
break; | break; | ||||
case AF_ARP: | case AF_ARP: | ||||
{ | { | ||||
struct arphdr *ah; | struct arphdr *ah; | ||||
ah = mtod(m, struct arphdr *); | ah = mtod(m, struct arphdr *); | ||||
ah->ar_hrd = htons(ARPHRD_IEEE1394); | ah->ar_hrd = htons(ARPHRD_IEEE1394); | ||||
type = ETHERTYPE_ARP; | |||||
if (unicast) | if (unicast) | ||||
*destfw = *(struct fw_hwaddr *) ar_tha(ah); | *destfw = *(struct fw_hwaddr *) ar_tha(ah); | ||||
/* | /* | ||||
* The standard arp code leaves a hole for the target | * The standard arp code leaves a hole for the target | ||||
* hardware address which we need to close up. | * hardware address which we need to close up. | ||||
*/ | */ | ||||
bcopy(ar_tpa(ah), ar_tha(ah), ah->ar_pln); | bcopy(ar_tpa(ah), ar_tha(ah), ah->ar_pln); | ||||
m_adj(m, -ah->ar_hln); | m_adj(m, -ah->ar_hln); | ||||
break; | break; | ||||
} | } | ||||
#endif | #endif | ||||
#ifdef INET6 | #ifdef INET6 | ||||
case AF_INET6: | case AF_INET6: | ||||
if (unicast) { | if (unicast) { | ||||
error = nd6_resolve(fc->fc_ifp, LLE_SF(AF_INET6, is_gw), | error = nd6_resolve(fc->fc_ifp, LLE_SF(af, is_gw), m, | ||||
m, dst, (u_char *) destfw, NULL, NULL); | dst, (u_char *) destfw, NULL, NULL); | ||||
if (error) | if (error) | ||||
return (error == EWOULDBLOCK ? 0 : error); | return (error == EWOULDBLOCK ? 0 : error); | ||||
} | } | ||||
type = ETHERTYPE_IPV6; | |||||
break; | break; | ||||
#endif | #endif | ||||
default: | default: | ||||
if_printf(ifp, "can't handle af%d\n", dst->sa_family); | if_printf(ifp, "can't handle af%d\n", dst->sa_family); | ||||
error = EAFNOSUPPORT; | error = EAFNOSUPPORT; | ||||
goto bad; | goto bad; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 663 Lines • Show Last 20 Lines |