Commit 9739946cc5b616c026d433bd07d193cf452ddea0
Committed by
Ben Warren
1 parent
6f5f89f011
Exists in
master
and in
54 other branches
./net/net.c - make Microsoft dns servers happy with random_port() numbers
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>
Showing 1 changed file with 4 additions and 2 deletions Side-by-side Diff
net/net.c
... | ... | @@ -1872,11 +1872,13 @@ |
1872 | 1872 | |
1873 | 1873 | #if defined(CONFIG_CMD_NFS) || defined(CONFIG_CMD_SNTP) || defined(CONFIG_CMD_DNS) |
1874 | 1874 | /* |
1875 | - * make port a little random, but use something trivial to compute | |
1875 | + * make port a little random (1024-17407) | |
1876 | + * This keeps the math somewhat trivial to compute, and seems to work with | |
1877 | + * all supported protocols/clients/servers | |
1876 | 1878 | */ |
1877 | 1879 | unsigned int random_port(void) |
1878 | 1880 | { |
1879 | - return 1024 + (get_timer(0) % 0x8000);; | |
1881 | + return 1024 + (get_timer(0) % 0x4000); | |
1880 | 1882 | } |
1881 | 1883 | #endif |
1882 | 1884 |