]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
./net/net.c - make Microsoft dns servers happy with random_port() numbers
authorRobin Getz <rgetz@blackfin.uclinux.org>
Mon, 8 Mar 2010 19:07:00 +0000 (14:07 -0500)
committerBen Warren <biggerbadderben@gmail.com>
Mon, 3 May 2010 21:52:48 +0000 (14:52 -0700)
For some reason, (which I can't find any documentation on), if U-Boot
gives a port number higher than 17500 to a Microsoft DNS server, the
server will reply to port 17500, and U-Boot will ignore things (since
that isn't the port it asked the DNS server to reply to).

This fixes that by ensuring the random port number is less than 17500.

Signed-off-by: Robin Getz <rgetz@blackfin.uclinux.org>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
net/net.c

index 7d2220d48dec224529f2917734965d1d0e73d526..cda731986b721c27b917f6fb31d451e4b5fe8785 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -1872,11 +1872,13 @@ void copy_filename (char *dst, char *src, int size)
 
 #if defined(CONFIG_CMD_NFS) || defined(CONFIG_CMD_SNTP) || defined(CONFIG_CMD_DNS)
 /*
- * make port a little random, but use something trivial to compute
+ * make port a little random (1024-17407)
+ * This keeps the math somewhat trivial to compute, and seems to work with
+ * all supported protocols/clients/servers
  */
 unsigned int random_port(void)
 {
-       return 1024 + (get_timer(0) % 0x8000);;
+       return 1024 + (get_timer(0) % 0x4000);
 }
 #endif