diff options
author | Michael Brown <mcb30@etherboot.org> | 2008-07-10 04:21:10 +0100 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2008-07-10 04:21:10 +0100 |
commit | 21e9e801e268302cf2705d9b0e658f9896963fe0 (patch) | |
tree | f89968893adfa0d5041225d1256d11aab24a0f36 /src/net/udp.c | |
parent | 6f39dfe6c0853f409519279fc1babaf2dc02dc9b (diff) | |
download | ipxe-21e9e801e268302cf2705d9b0e658f9896963fe0.tar.gz |
[udp] Avoid reusing auto-allocated ports after connection close.
This duplicates a fix made to tcp.c in commit
d5735c631cf26d8e1bcf7b5e635623b52d6b48aa.
Diffstat (limited to 'src/net/udp.c')
-rw-r--r-- | src/net/udp.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/net/udp.c b/src/net/udp.c index 8df76a44..407ea14d 100644 --- a/src/net/udp.c +++ b/src/net/udp.c @@ -55,11 +55,12 @@ struct tcpip_protocol udp_protocol; */ static int udp_bind ( struct udp_connection *udp ) { struct udp_connection *existing; - static uint16_t try_port = 1024; + static uint16_t try_port = 1023; /* If no port specified, find the first available port */ if ( ! udp->local.st_port ) { - for ( ; try_port ; try_port++ ) { + while ( try_port ) { + try_port++; if ( try_port < 1024 ) continue; udp->local.st_port = htons ( try_port ); |