diff options
author | Wolfgang Denk <wd@pollux.(none)> | 2005-09-24 22:37:32 +0200 |
---|---|---|
committer | Wolfgang Denk <wd@pollux.(none)> | 2005-09-24 22:37:32 +0200 |
commit | ecb0ccd9c260701183bc8d35966e65e6a2feb2f6 (patch) | |
tree | df0f0ae80b3aab8666227305a709b7940cc9949b /net/tftp.c | |
parent | 4bc12f1ccf8f449c875594675f2d86305bb74097 (diff) |
Allow to force TFTP to use a fixed UDP port
(Add a configuration option CONFIG_TFTP_PORT and optional env variable tftpport)
Patch by Jerry Van Baren, 10 Jan 2005
Diffstat (limited to 'net/tftp.c')
-rw-r--r-- | net/tftp.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/net/tftp.c b/net/tftp.c index 03a002767a7..a7c246a7de5 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -313,6 +313,10 @@ TftpTimeout (void) void TftpStart (void) { +#ifdef CONFIG_TFTP_PORT + char *ep; /* Environment pointer */ +#endif + if (BootFile[0] == '\0') { sprintf(default_filename, "%02lX%02lX%02lX%02lX.img", NetOurIP & 0xFF, @@ -364,7 +368,13 @@ TftpStart (void) TftpServerPort = WELL_KNOWN_PORT; TftpTimeoutCount = 0; TftpState = STATE_RRQ; + /* Use a pseudo-random port unless a specific port is set */ TftpOurPort = 1024 + (get_timer(0) % 3072); +#ifdef CONFIG_TFTP_PORT + if ((ep = getenv("tftpport")) != NULL) { + TftpOurPort= simple_strtol(ep, NULL, 10); + } +#endif TftpBlock = 0; /* zero out server ether in case the server ip has changed */ |