summaryrefslogtreecommitdiffstats
path: root/sys/netinet/if_ether.c
diff options
context:
space:
mode:
authorbms <bms@FreeBSD.org>2007-02-02 20:31:44 +0000
committerbms <bms@FreeBSD.org>2007-02-02 20:31:44 +0000
commit4341e5c6f6475cb79a6835fe07b0e3655b199779 (patch)
treeda8aa262b6f924b346f4e795cdc8c4031ba7ed6f /sys/netinet/if_ether.c
parent04771e3c14c96f6a22e1dd7aa2d9b4feeab44349 (diff)
downloadFreeBSD-src-4341e5c6f6475cb79a6835fe07b0e3655b199779.zip
FreeBSD-src-4341e5c6f6475cb79a6835fe07b0e3655b199779.tar.gz
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
Diffstat (limited to 'sys/netinet/if_ether.c')
-rw-r--r--sys/netinet/if_ether.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
index 8ee7132..e736597 100644
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -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;
OpenPOWER on IntegriCloud