Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[udp] Avoid reusing auto-allocated ports after connection close.
This duplicates a fix made to tcp.c in commit
d5735c6.
  • Loading branch information
Michael Brown committed Jul 10, 2008
1 parent 6f39dfe commit 21e9e80
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/net/udp.c
Expand Up @@ -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 );
Expand Down

0 comments on commit 21e9e80

Please sign in to comment.