[U-Boot] [PATCH] - add dns

Robin Getz rgetz at blackfin.uclinux.org
Sun Jul 19 02:27:00 CEST 2009


On Sat 18 Jul 2009 18:11, Mike Frysinger pondered:
> 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);

Sure.

> 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 */

OK - So, this would give three different variations:

net/sntp.c:     SntpOurPort = 10000 + (get_timer(0) % 4096);
net/tftp.c:     TftpOurPort = 1024 + (get_timer(0) % 3072);
net/nfs.c:      NfsOurPort = 4096 + (get_ticks() % 3072);

Does it make sense to have 4 different ones? (not to me)...

Or something new & common in ./net.c:random_port()

Ben?

> > +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 ?

Nope - I can remove that...

> > +/* 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

Hmm - didn't notice that one from the orginal. Thanks 
(I'm surprised that checkpatch didn't complain).

Since there aren't any functionality differences - I'll send out a new version on 
Monday for Ben - since he is away anyway (unless someone else comments tomorrow).

-Robin


More information about the U-Boot mailing list