Handle AF_ARP in *_output()

Obtained from:	NetBSD
This commit is contained in:
Matthew N. Dodd 2004-03-14 05:24:54 +00:00
parent 1669fd499d
commit 43a6c75a7a
3 changed files with 81 additions and 0 deletions

View File

@ -168,6 +168,33 @@ ether_output(struct ifnet *ifp, struct mbuf *m,
return (0); /* if not yet resolved */
type = htons(ETHERTYPE_IP);
break;
case AF_ARP:
{
struct arphdr *ah;
ah = mtod(m, struct arphdr *);
ah->ar_hrd = htons(ARPHRD_ETHER);
loop_copy = -1; /* if this is for us, don't do it */
switch(ntohs(ah->ar_op)) {
case ARPOP_REVREQUEST:
case ARPOP_REVREPLY:
type = htons(ETHERTYPE_REVARP);
break;
case ARPOP_REQUEST:
case ARPOP_REPLY:
default:
type = htons(ETHERTYPE_ARP);
break;
}
if (m->m_flags & M_BCAST)
bcopy(ifp->if_broadcastaddr, edst, ETHER_ADDR_LEN);
else
bcopy(ar_tha(ah), edst, ETHER_ADDR_LEN);
}
break;
#endif
#ifdef INET6
case AF_INET6:

View File

@ -146,6 +146,33 @@ fddi_output(ifp, m, dst, rt0)
type = htons(ETHERTYPE_IP);
break;
}
case AF_ARP:
{
struct arphdr *ah;
ah = mtod(m, struct arphdr *);
ah->ar_hrd = htons(ARPHRD_ETHER);
loop_copy = -1; /* if this is for us, don't do it */
switch (ntohs(ah->ar_op)) {
case ARPOP_REVREQUEST:
case ARPOP_REVREPLY:
type = htons(ETHERTYPE_REVARP);
break;
case ARPOP_REQUEST:
case ARPOP_REPLY:
default:
type = htons(ETHERTYPE_ARP);
break;
}
if (m->m_flags & M_BCAST)
bcopy(ifp->if_broadcastaddr, edst, FDDI_ADDR_LEN);
else
bcopy(ar_tha(ah), edst, FDDI_ADDR_LEN);
}
break;
#endif /* INET */
#ifdef INET6
case AF_INET6:

View File

@ -292,6 +292,33 @@ iso88025_output(ifp, m, dst, rt0)
return (0); /* if not yet resolved */
snap_type = ETHERTYPE_IP;
break;
case AF_ARP:
{
struct arphdr *ah;
ah = mtod(m, struct arphdr *);
ah->ar_hrd = htons(ARPHRD_IEEE802);
loop_copy = -1; /* if this is for us, don't do it */
switch(ntohs(ah->ar_op)) {
case ARPOP_REVREQUEST:
case ARPOP_REVREPLY:
snap_type = ETHERTYPE_REVARP;
break;
case ARPOP_REQUEST:
case ARPOP_REPLY:
default:
snap_type = ETHERTYPE_ARP;
break;
}
if (m->m_flags & M_BCAST)
bcopy(ifp->if_broadcastaddr, edst, ISO88025_ADDR_LEN);
else
bcopy(ar_tha(ah), edst, ISO88025_ADDR_LEN);
}
break;
#endif /* INET */
#ifdef INET6
case AF_INET6: