[U-Boot] [PATCH] - add dns

Mike Frysinger vapier at gentoo.org
Sun Jul 19 00:11:50 CEST 2009


On Saturday 18 July 2009 01:14:25 Robin Getz wrote:
> +	DnsOurPort = 10000 + (get_timer(0) % 4096);

4096 port range seems kind of small.  i dont think the requests really need to 
be greater than 10000.  not sure if services would get pissed about being 
below the 1024 limit though, so this is probably better:
1024 + (get_timer() % 0x8000);

keep the modulus something with only 1 bit set so gcc will optimize into a 
simple and operation.  probably add a comment about it too:
	/* make src port a little random, but use something trivial to compute */

> +void
> +DnsStart(void)
> +{
> +	NetSetTimeout(DNS_TIMEOUT, DnsTimeout);
> +	NetSetHandler(DnsHandler);
> +	memset(NetServerEther, 0, 6);

is clearing the ether address really necessary ?  if so, why should the dns 
code care about it ?

> +/* http://en.wikipedia.org/wiki/List_of_DNS_record_types */
> +enum dns_query_type {
> +	DNS_A_RECORD = 0x01,
> +	DNS_CNAME_RECORD = 0x05,
> +	DNS_MX_RECORD = 0x0f };

that last }; should be on a line by itself, and the last entry should still 
have a comma at the end
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090718/ceb9e8c5/attachment.pgp 


More information about the U-Boot mailing list