All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 1/1] net: dns: fix for DNS queries sent to the wrong MAC address
@ 2014-09-12  6:48 Gerhard Sittig
  2014-09-17  0:46 ` [U-Boot] [U-Boot, v2, " Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Gerhard Sittig @ 2014-09-12  6:48 UTC (permalink / raw)
  To: u-boot

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@psi.ch>
Signed-off-by: Gerhard Sittig <gsi@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.

changes in v2:
- adjust the recipients lists to include the network custodian
- drop an obvious/redundant comment as recommended by Joe Hershberger

---
 net/dns.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/dns.c b/net/dns.c
index ff9ddffc9d0a..dd4532015045 100644
--- a/net/dns.c
+++ b/net/dns.c
@@ -202,5 +202,8 @@ DnsStart(void)
 	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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [U-Boot, v2, 1/1] net: dns: fix for DNS queries sent to the wrong MAC address
  2014-09-12  6:48 [U-Boot] [PATCH v2 1/1] net: dns: fix for DNS queries sent to the wrong MAC address Gerhard Sittig
@ 2014-09-17  0:46 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2014-09-17  0:46 UTC (permalink / raw)
  To: u-boot

On Fri, Sep 12, 2014 at 08:48:15AM +0200, Gerhard Sittig wrote:

> 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@psi.ch>
> Signed-off-by: Gerhard Sittig <gsi@denx.de>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140916/5ba1696f/attachment.pgp>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-17  0:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-12  6:48 [U-Boot] [PATCH v2 1/1] net: dns: fix for DNS queries sent to the wrong MAC address Gerhard Sittig
2014-09-17  0:46 ` [U-Boot] [U-Boot, v2, " Tom Rini

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.