* [U-Boot] [PATCH] net: Correct check for link-local target IP conflict
@ 2013-02-08 20:18 Joe Hershberger
2013-07-08 16:07 ` Joe Hershberger
0 siblings, 1 reply; 2+ messages in thread
From: Joe Hershberger @ 2013-02-08 20:18 UTC (permalink / raw)
To: u-boot
Make the link-local code conform more completely with the RFC.
This will prevent ARP queries for the target (such as while it is
rebooting) from causing the device to choose a different link-local
address, thinking that its address is in use by another machine.
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---
net/link_local.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/net/link_local.c b/net/link_local.c
index 1ba796e..9a887d8 100644
--- a/net/link_local.c
+++ b/net/link_local.c
@@ -206,6 +206,7 @@ void link_local_receive_arp(struct arp_hdr *arp, int len)
{
int source_ip_conflict;
int target_ip_conflict;
+ IPaddr_t null_ip = 0;
if (state == DISABLED)
return;
@@ -267,9 +268,18 @@ void link_local_receive_arp(struct arp_hdr *arp, int len)
) {
source_ip_conflict = 1;
}
+
+ /*
+ * According to RFC 3927, section 2.2.1:
+ * Check if packet is an ARP probe by checking for a null source IP
+ * then check that target IP is equal to ours and source hw addr
+ * is not equal to ours. This condition should cause a conflict only
+ * during probe.
+ */
if (arp->ar_op == htons(ARPOP_REQUEST)
+ && memcmp(&arp->ar_spa, &null_ip, ARP_PLEN) == 0
&& memcmp(&arp->ar_tpa, &ip, ARP_PLEN) == 0
- && memcmp(&arp->ar_tha, NetOurEther, ARP_HLEN) != 0
+ && memcmp(&arp->ar_sha, NetOurEther, ARP_HLEN) != 0
) {
target_ip_conflict = 1;
}
--
1.7.11.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH] net: Correct check for link-local target IP conflict
2013-02-08 20:18 [U-Boot] [PATCH] net: Correct check for link-local target IP conflict Joe Hershberger
@ 2013-07-08 16:07 ` Joe Hershberger
0 siblings, 0 replies; 2+ messages in thread
From: Joe Hershberger @ 2013-07-08 16:07 UTC (permalink / raw)
To: u-boot
On Fri, Feb 8, 2013 at 2:18 PM, Joe Hershberger <joe.hershberger@ni.com> wrote:
> Make the link-local code conform more completely with the RFC.
>
> This will prevent ARP queries for the target (such as while it is
> rebooting) from causing the device to choose a different link-local
> address, thinking that its address is in use by another machine.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Applied, Thanks.
-Joe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-07-08 16:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-08 20:18 [U-Boot] [PATCH] net: Correct check for link-local target IP conflict Joe Hershberger
2013-07-08 16:07 ` Joe Hershberger
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.