[U-Boot] [PATCH v1 1/1] net: dns: fix for DNS queries sent to the wrong MAC address
Gerhard Sittig
gsi at denx.de
Fri Sep 5 13:19:19 CEST 2014
When a DNS query is sent out, the ethernet packet can get directed to
the MAC address of a server that was communicated to before. This is
wrong when the previously stored MAC address corresponds to a different
server's IP address, i.e. when the IP address of the previous and the
current communication are different.
The error can get reproduced by running a sequence of e.g. a TFTP
download and a DNS query, where the TFTP and DNS servers reside on
individual machines.
The fix is to clear the server's MAC address that might be left from a
previous operation, and to fetch the peer's MAC address in a new ARP
lookup, before the DNS query is sent. This is the approach taken in
other network services, like 8e52533d1095 ("net: tftpsrv: Get correct
client MAC address").
Reported-by: Dirk Zimoch <dirk.zimoch at psi.ch>
Signed-off-by: Gerhard Sittig <gsi at denx.de>
---
This patch suffers from a checkpatch warning about CamelCase, which
cannot get resolved, as it is a consequence of established identifier
names in the network part of the code base.
---
net/dns.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/dns.c b/net/dns.c
index ff9ddffc9d0a..b667bdb528f7 100644
--- a/net/dns.c
+++ b/net/dns.c
@@ -199,8 +199,12 @@ DnsStart(void)
{
debug("%s\n", __func__);
+ /* Register handlers for incoming packets and timeouts. */
NetSetTimeout(DNS_TIMEOUT, DnsTimeout);
net_set_udp_handler(DnsHandler);
+ /* Clear a previous MAC address, the server IP might have changed. */
+ memset(NetServerEther, 0, sizeof(NetServerEther));
+
DnsSend();
}
--
1.7.10.4
More information about the U-Boot
mailing list