diff mbox

[U-Boot,27/28] net: Work-around for brain-damaged Cisco routers with arp-proxy

Message ID 1327020811-1538-28-git-send-email-joe.hershberger@ni.com
State Superseded
Delegated to: Joe Hershberger
Headers show

Commit Message

Joe Hershberger Jan. 20, 2012, 12:53 a.m. UTC
Cisco's arp-proxy feature fails to ignore the link-local address range
This means that a link-local device on a network with this Cisco
   equipment will reply to ARP requests for our device (in addition
   to our reply)
If we happen to reply first, the requester's ARP table will be
   populated with our MAC address, and one packet will be sent to us...
   shortly following this, the requester will get an ARP reply from
   the Cisco equipment telling the requester to send packets their
   way instead of to our device from now on
This work-around detects this link-local condition and will delay
   replying to the ARP request for 5ms so that the first packet is
   sent to the Cisco equipment and all following packets are sent to
   our device

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Cc: Joe Hershberger <joe.hershberger@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
---
 net/arp.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

Comments

Mike Frysinger Feb. 3, 2012, 12:44 p.m. UTC | #1
On Thursday 19 January 2012 19:53:30 Joe Hershberger wrote:
> Cisco's arp-proxy feature fails to ignore the link-local address range
> This means that a link-local device on a network with this Cisco
>    equipment will reply to ARP requests for our device (in addition
>    to our reply)
> ...
> --- a/net/arp.c
> +++ b/net/arp.c
>
> +		/*
> +		 * Work-around for brain-damaged Cisco equipment with
> +		 *   arp-proxy enabled.
> +		 *
> +		 *   If the requesting IP is not on our subnet, wait 5ms to
> +		 *   reply to ARP request so that our reply will overwrite
> +		 *   the arp-proxy's instead of the other way around.
> +		 */
> +		if ((NetReadIP(&arp->ar_tpa) & NetOurSubnetMask) !=
> +		    (NetReadIP(&arp->ar_spa) & NetOurSubnetMask))
> +			udelay(5000);

shouldn't this sit behind a link local ifdef then ?
-mike
diff mbox

Patch

diff --git a/net/arp.c b/net/arp.c
index 9eb4ab0..8a7b4a2 100644
--- a/net/arp.c
+++ b/net/arp.c
@@ -172,6 +172,19 @@  void ArpReceive(struct Ethernet_t *et, struct IP_UDP_t *ip, int len)
 		NetCopyIP(&arp->ar_tpa, &arp->ar_spa);
 		memcpy(&arp->ar_sha, NetOurEther, ARP_HLEN);
 		NetCopyIP(&arp->ar_spa, &NetOurIP);
+
+		/*
+		 * Work-around for brain-damaged Cisco equipment with
+		 *   arp-proxy enabled.
+		 *
+		 *   If the requesting IP is not on our subnet, wait 5ms to
+		 *   reply to ARP request so that our reply will overwrite
+		 *   the arp-proxy's instead of the other way around.
+		 */
+		if ((NetReadIP(&arp->ar_tpa) & NetOurSubnetMask) !=
+		    (NetReadIP(&arp->ar_spa) & NetOurSubnetMask))
+			udelay(5000);
+
 		NetSendPacket((uchar *)et, eth_hdr_size + ARP_HDR_SIZE);
 		return;