Comply with RFC 3927, by forcing ARP replies which contain a source
address within the link-local IPv4 prefix 169.254.0.0/16, to be broadcast at link layer. Reviewed by: fenner MFC after: 2 weeks
This commit is contained in:
parent
8866f04eb1
commit
d055815799
@ -885,11 +885,23 @@ reply:
|
||||
}
|
||||
}
|
||||
|
||||
if (itaddr.s_addr == myaddr.s_addr &&
|
||||
IN_LINKLOCAL(ntohl(itaddr.s_addr))) {
|
||||
/* RFC 3927 link-local IPv4; always reply by broadcast. */
|
||||
#ifdef DEBUG_LINKLOCAL
|
||||
printf("arp: sending reply for link-local addr %s\n",
|
||||
inet_ntoa(itaddr));
|
||||
#endif
|
||||
m->m_flags |= M_BCAST;
|
||||
m->m_flags &= ~M_MCAST;
|
||||
} else {
|
||||
/* default behaviour; never reply by broadcast. */
|
||||
m->m_flags &= ~(M_BCAST|M_MCAST);
|
||||
}
|
||||
(void)memcpy(ar_tpa(ah), ar_spa(ah), ah->ar_pln);
|
||||
(void)memcpy(ar_spa(ah), &itaddr, ah->ar_pln);
|
||||
ah->ar_op = htons(ARPOP_REPLY);
|
||||
ah->ar_pro = htons(ETHERTYPE_IP); /* let's be sure! */
|
||||
m->m_flags &= ~(M_BCAST|M_MCAST); /* never reply by broadcast */
|
||||
m->m_len = sizeof(*ah) + (2 * ah->ar_pln) + (2 * ah->ar_hln);
|
||||
m->m_pkthdr.len = m->m_len;
|
||||
sa.sa_family = AF_ARP;
|
||||
|
Loading…
x
Reference in New Issue
Block a user