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

From: David Daney
Date: Fri Mar 31 2006 - 18:23:10 EST


From: David Daney

Greetings,

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 (169.254.0.0/16). 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 169.254.0.0/16, 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 <freek@xxxxxxxxxxx>
>
.
.
.
>
> 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 2.6.16.1

Signed-off-by: David Daney <ddaney@xxxxxxxxxx>

---

--- 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)
return;

+ /* If link local address (169.254.0.0/16) 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) {
return;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/