X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=net%2Farp.c;h=8e1d2edd6207a43e4ad16a5d42a3aad8147427ce;hb=aa42cb71fa28a4f2c8b8cc0e691151f4ba19dbd9;hp=908ebf53165a334e25096be1719241db138700e0;hpb=228041893c2b6f79326f4b49ee7b3b3a90e90e8e;p=u-boot diff --git a/net/arp.c b/net/arp.c index 908ebf5316..8e1d2edd62 100644 --- a/net/arp.c +++ b/net/arp.c @@ -55,7 +55,7 @@ void arp_raw_request(IPaddr_t sourceIP, const uchar *targetEther, struct arp_hdr *arp; int eth_hdr_size; - debug("ARP broadcast %d\n", NetArpWaitTry); + debug_cond(DEBUG_DEV_PKT, "ARP broadcast %d\n", NetArpWaitTry); pkt = NetArpTxPacket; @@ -135,7 +135,7 @@ void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len) * address; so if we receive such a packet, we set * the server ethernet address */ - debug("Got ARP\n"); + debug_cond(DEBUG_NET_PKT, "Got ARP\n"); arp = (struct arp_hdr *)ip; if (len < ARP_HDR_SIZE) { @@ -160,7 +160,7 @@ void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len) switch (ntohs(arp->ar_op)) { case ARPOP_REQUEST: /* reply with our IP address */ - debug("Got ARP REQUEST, return our IP\n"); + debug_cond(DEBUG_DEV_PKT, "Got ARP REQUEST, return our IP\n"); pkt = (uchar *)et; eth_hdr_size = net_update_ether(et, et->et_src, PROT_ARP); pkt += eth_hdr_size; @@ -169,6 +169,20 @@ void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len) NetCopyIP(&arp->ar_tpa, &arp->ar_spa); memcpy(&arp->ar_sha, NetOurEther, ARP_HLEN); NetCopyIP(&arp->ar_spa, &NetOurIP); + +#ifdef CONFIG_CMD_LINK_LOCAL + /* + * 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); +#endif NetSendPacket((uchar *)et, eth_hdr_size + ARP_HDR_SIZE); return; @@ -180,7 +194,7 @@ void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len) #ifdef CONFIG_KEEP_SERVERADDR if (NetServerIP == NetArpWaitPacketIP) { char buf[20]; - sprintf(buf, "%pM", arp->ar_sha); + sprintf(buf, "%pM", &arp->ar_sha); setenv("serveraddr", buf); } #endif @@ -189,7 +203,8 @@ void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len) /* matched waiting packet's address */ if (reply_ip_addr == NetArpWaitReplyIP) { - debug("Got ARP REPLY, set eth addr (%pM)\n", + debug_cond(DEBUG_DEV_PKT, + "Got ARP REPLY, set eth addr (%pM)\n", arp->ar_data); /* save address for later use */