[PATCH] net: Broadcast ARP packets on link local addresses

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: David Daney


When an internet host joins a network where there is no DHCP server,
it may auto-allocate an IP address by the method described in RFC
3927.  There are several user space daemons available that implement
most of the protocol (zcip, busybox, ...).  The kernel's APR driver
should function in the normal manner except that it is required to
broadcast all ARP packets that it originates in the link local address
space (  RFC 3927 section 2.5 explains the requirement.

The current ARP code is non-compliant because it does not broadcast
some ARP packets as required by RFC 3927.

This patch to net/ipv4/arp.c checks the source address of all ARP
packets and if the fall in, they are broadcast instead
of unicast.  I would like to thank Freek Dijkstra wrote the first
version of the patch.  He was kind enough to sign off on it in his
(off-list) e-mail to me:

>David Daney wrote:
>> For the linux kernel the requirements for contributing are quite easy.
>> All people who wrote the patch simply affirm that they are have the
>> right to contribute and that they are doing so.  See section 11 of
>> Documentation/SubmittingPatches in the kernel source tree.
> Just read. (a) and (d) apply (I wrote it, and I'm fine that you use it):
> Signed-off-by: Freek Dijkstra <[email protected]>
> I hereby release the above patch in the public domain.
> (You may credit me or not, I don't think it's needed).
> Have fun.
> Freek

This patch is against 

Signed-off-by: David Daney <[email protected]>


--- net/ipv4/arp.c.orig	2006-03-31 13:44:50.000000000 -0800
+++ net/ipv4/arp.c	2006-03-31 13:48:26.000000000 -0800
@@ -682,6 +682,7 @@ void arp_send(int type, int ptype, u32 d
 	      unsigned char *target_hw)
 	struct sk_buff *skb;
+	int lla;
 	 *	No arp on this interface.
@@ -690,8 +691,13 @@ void arp_send(int type, int ptype, u32 d
 	if (dev->flags&IFF_NOARP)
+	/* If link local address ( we must broadcast
+         * the ARP packet.  See RFC 3927 section 2.5 for details.
+	 */
+	lla = (dest_ip & htonl(0xFFFF0000UL)) == htonl(0xA9FE0000UL);
 	skb = arp_create(type, ptype, dest_ip, dev, src_ip,
-			 dest_hw, src_hw, target_hw);
+			 lla ? NULL : dest_hw, src_hw, target_hw);
 	if (skb == NULL) {
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux