summaryrefslogtreecommitdiff
path: root/gpxe/src/net/udp.c
diff options
context:
space:
mode:
Diffstat (limited to 'gpxe/src/net/udp.c')
-rw-r--r--gpxe/src/net/udp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gpxe/src/net/udp.c b/gpxe/src/net/udp.c
index 8df76a44..407ea14d 100644
--- a/gpxe/src/net/udp.c
+++ b/gpxe/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 );