474 |
#define UDP_LOCAL_PORT_RANGE_START 4096 |
#define UDP_LOCAL_PORT_RANGE_START 4096 |
475 |
#define UDP_LOCAL_PORT_RANGE_END 0x7fff |
#define UDP_LOCAL_PORT_RANGE_END 0x7fff |
476 |
#endif |
#endif |
477 |
port = UDP_LOCAL_PORT_RANGE_START; |
port = UDP_LOCAL_PORT_RANGE_START; |
478 |
ipcb = udp_pcbs; |
ipcb = udp_pcbs; |
479 |
while((ipcb != NULL) && (port != UDP_LOCAL_PORT_RANGE_END)) { |
while((ipcb != NULL) && (port != UDP_LOCAL_PORT_RANGE_END)) { |
480 |
if(ipcb->local_port == port) { |
if(ipcb->local_port == port) { |
481 |
port++; |
port++; |
482 |
ipcb = udp_pcbs; |
ipcb = udp_pcbs; |
483 |
} else |
} else |
484 |
ipcb = ipcb->next; |
ipcb = ipcb->next; |
485 |
} |
} |
486 |
if(ipcb) /* no more ports available in local range */ |
if(ipcb) { |
487 |
|
/* no more ports available in local range */ |
488 |
DEBUGF(UDP_DEBUG, ("udp_bind: out of free UDP ports\n")); |
DEBUGF(UDP_DEBUG, ("udp_bind: out of free UDP ports\n")); |
489 |
return ERR_USE; |
return ERR_USE; |
490 |
|
} |
491 |
} |
} |
492 |
pcb->local_port = port; |
pcb->local_port = port; |
493 |
/* We need to place the PCB on the list if not already there. */ |
/* We need to place the PCB on the list if not already there. */ |