[U-Boot] Possible fix for dns command

Mathias Adam m.adam--uboot at adamis.de
Wed Nov 23 11:58:44 CET 2011


Hi Stefano,

Am Mi, 23.11.2011, 10:57 schrieb Stefano Babic:
> On 16/11/2011 13:37, Mathias Adam wrote:
>> I'm currently using u-boot on a TI DM816x evaluation board (u-boot as
>> included in TI's EZSDK 5.02). I manually enabled CONFIG_CMD_DNS.
>> However,
>> running dhcp followed by dns <some_host_name> only gave timeouts.
>>
>> I found (using #define DEBUG) that DNS UDP queries are being sent to the
>> MAC of the DHCP server -- which is not equal to the DNS server, hence
>> the
>> timeouts.
>
> I have checked this issue, but I am coming to a different conclusion. I
> have sniffed the network between the DHCP server and the target, and the
> target is able to recognize the option 6 (DNS - name server) of the DHCP
> OFFER.
>
> However, the code setting the variable using by the DNS command
> ("dnsip") is not set if a file is not loaded by the TFTP server.
>
> In cmd_net.c, you see:
>
>         if ((size = NetLoop(proto)) < 0) {
>                 show_boot_progress (-81);
>                 return 1;
>         }
>
> After that, netboot_update_env is called setting correctly the
> variables. So if the transfer stops or is not successful, the dnsip
> variable is not updated.
>
> Can you check (it is not the right fix !) if commenting the above return
> statement fixes the issue you report ?


Just tried that: unfortunately it still doesn't work.

However, the problem I encountered is not that $dnsip wouldn't get set,
this part worked correctly out of the box.  But then, the dns command
doesn't perform an ARP query to get the MAC address of the machine with IP
$dnsip but instead uses whatever MAC address is stored in NetServerEther.

As mentioned before, I found that tftpboot does make an ARP query and
stores the result in NetServerEther. In fact, when I start a "dummy" tftp
access dns works, at least one time:

TI8168_EVM#tftp 0x81000000 :dummy
Using DaVinci EMAC device
TFTP from server 0.0.0.0; our IP address is 17x.xxx.yyy.126; sending
through gateway 17x.xxx.yyy.50
Filename 'dummy'.
Load address: 0x81000000
Loading: T
TFTP error: 'File not found' (1)
Not retrying...
TI8168_EVM#dns google.com
209.85.148.105
TI8168_EVM#dns google.com
Timeout
dns lookup of google.com failed, check setup
TI8168_EVM#

(the DNS server is located behind the default gateway so has the same MAC
address).



>> Forcing ARP queries before DNS fixed this (see patch below).
>
> I do not think this is correct.

hmm, not sure about u-boot, but generally I think it is a good idea to do
an ARP query before sending packets to some IP address  ;-)


Regards,
Mathias Adam



More information about the U-Boot mailing list