[U-Boot] [PATCH] Fix dns command

Graeme Russ graeme.russ at gmail.com
Wed Nov 23 21:59:20 CET 2011


Hi Mathias,

On Thu, Nov 24, 2011 at 3:27 AM, Mathias Adam <m.adam--uboot at adamis.de> wrote:
> The dns command didn't perform an ARP query to get the MAC address of
> the DNS server if a MAC address was already stored in NetServerEther.
> In that case the stored address was used no matter what IP address it
> belongs to.
>
> With this patch, NetServerEther is being cleared before a DNS query to
> force an ARP request.
>
> Signed-off-by: Mathias Adam <m.adam--uboot at adamis.de>
> ---
>  net/dns.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/net/dns.c b/net/dns.c
> index 7a3f1f9..9d79d7d 100644
> --- a/net/dns.c
> +++ b/net/dns.c
> @@ -202,5 +202,8 @@ DnsStart(void)
>        NetSetTimeout(DNS_TIMEOUT, DnsTimeout);
>        NetSetHandler(DnsHandler);
>
> +       /* zero out server ether in case the server ip has changed */
> +       memset(NetServerEther, 0, 6);
> +
>        DnsSend();
>  }

Why not do this at the start of net-loop - It may introduce more ARP
requests, but at least any new protocols will autmatically avoid the
bug you are experiencing

You could cache the IP address which matches NetServerEther to avoid
the ARP when doing the same command repeatedly

Regards,

Graeme


More information about the U-Boot mailing list