Bladeren bron

[udp] Avoid reusing auto-allocated ports after connection close.

This duplicates a fix made to tcp.c in commit
d5735c631c.
tags/v0.9.4
Michael Brown 16 jaren geleden
bovenliggende
commit
21e9e801e2
1 gewijzigde bestanden met toevoegingen van 3 en 2 verwijderingen
  1. 3
    2
      src/net/udp.c

+ 3
- 2
src/net/udp.c Bestand weergeven

@@ -55,11 +55,12 @@ struct tcpip_protocol udp_protocol;
55 55
  */
56 56
 static int udp_bind ( struct udp_connection *udp ) {
57 57
 	struct udp_connection *existing;
58
-	static uint16_t try_port = 1024;
58
+	static uint16_t try_port = 1023;
59 59
 
60 60
 	/* If no port specified, find the first available port */
61 61
 	if ( ! udp->local.st_port ) {
62
-		for ( ; try_port ; try_port++ ) {
62
+		while ( try_port ) {
63
+			try_port++;
63 64
 			if ( try_port < 1024 )
64 65
 				continue;
65 66
 			udp->local.st_port = htons ( try_port );

Laden…
Annuleren
Opslaan