public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ben Warren <biggerbadderben@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [Patch] ./net/net.c - make Microsoft dns servers happy with random_port() numbers
Date: Mon, 05 Apr 2010 00:17:18 -0700	[thread overview]
Message-ID: <4BB98E7E.5060103@gmail.com> (raw)
In-Reply-To: <201003081407.01006.rgetz@blackfin.uclinux.org>

Hi Robin,

On 3/8/2010 11:07 AM, Robin Getz wrote:
> 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>
>
> ---
>   net/net.c |    6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/net/net.c b/net/net.c
> index 595abd9..98d58e5 100644
> --- 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
>
>    
Applied to net repo.

thanks,
Ben

      parent reply	other threads:[~2010-04-05  7:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-08 19:07 [U-Boot] [Patch] ./net/net.c - make Microsoft dns servers happy with random_port() numbers Robin Getz
2010-03-09  8:37 ` Detlev Zundel
2010-04-05  7:17 ` Ben Warren [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BB98E7E.5060103@gmail.com \
    --to=biggerbadderben@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox