Przeglądaj źródła

[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 lat temu
rodzic
commit
21e9e801e2
1 zmienionych plików z 3 dodań i 2 usunięć
  1. 3
    2
      src/net/udp.c

+ 3
- 2
src/net/udp.c Wyświetl plik

@@ -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 );

Ładowanie…
Anuluj
Zapisz