- bcopy((caddr_t)ea->arp_sha, (caddr_t)ea->arp_tha,
- sizeof(ea->arp_sha));
- bcopy((caddr_t)ea->arp_spa, (caddr_t)ea->arp_tpa,
- sizeof(ea->arp_spa));
- if (at) /* done above if at == 0 */
+ switch (proto) {
+
+ case ETHERTYPE_IPTRAILERS:
+ /* partner says trailers are OK */
+ if (at)
+ at->at_flags |= ATF_USETRAILERS;
+ /*
+ * Reply to request iff we want trailers.
+ */
+ if (op != ARPOP_REQUEST || ac->ac_if.if_flags & IFF_NOTRAILERS)
+ goto out;
+ break;
+
+ case ETHERTYPE_IP:
+ /*
+ * Reply if this is an IP request, or if we want to send
+ * a trailer response.
+ */
+ if (op != ARPOP_REQUEST && ac->ac_if.if_flags & IFF_NOTRAILERS)
+ goto out;
+ }
+ if (itaddr.s_addr == myaddr.s_addr) {
+ /* I am the target */
+ bcopy((caddr_t)ea->arp_sha, (caddr_t)ea->arp_tha,
+ sizeof(ea->arp_sha));
+ bcopy((caddr_t)ac->ac_enaddr, (caddr_t)ea->arp_sha,
+ sizeof(ea->arp_sha));
+ } else {
+ ARPTAB_LOOK(at, itaddr.s_addr);
+ if (at == NULL || (at->at_flags & ATF_PUBL) == 0)
+ goto out;
+ bcopy((caddr_t)ea->arp_sha, (caddr_t)ea->arp_tha,
+ sizeof(ea->arp_sha));