[U-Boot] [PATCH] - add dns
Mike Frysinger
vapier at gentoo.org
Sun Jul 19 03:15:02 CEST 2009
On Saturday 18 July 2009 20:27:00 Robin Getz wrote:
> On Sat 18 Jul 2009 18:11, Mike Frysinger pondered:
> > 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()
i would make a new patch that adds a new random_port() function and converts
existing consumers to that, and then have the dns code rely on that.
and you should adopt my implementation because the generated code is much much
nicer than the others ;)
a quick google shows:
- sntp - any non-zero source port is OK
- tftp - "between 0 and 65535"
- nfs - couldnt find anything, but i'm pretty sure there isnt one
get_ticks() and get_timer(0) are pretty much equivalent
-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/905c3665/attachment.pgp
More information about the U-Boot
mailing list