|
|
|
|
@ -543,6 +543,8 @@ static uint16_t tcp_new_port(struct tcp_pcb *pcb)
|
|
|
|
|
{ |
|
|
|
|
struct lwip_tcp_ctx *ctx = pcb->ctx; |
|
|
|
|
uint16_t n = 0; |
|
|
|
|
struct tcp_pcb *lists[4]; |
|
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
ctx->port_seed++; |
|
|
|
|
if (ctx->port_seed < TCP_LOCAL_PORT_RANGE_START || ctx->port_seed >= TCP_LOCAL_PORT_RANGE_END) { |
|
|
|
|
@ -550,8 +552,8 @@ static uint16_t tcp_new_port(struct tcp_pcb *pcb)
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
again: |
|
|
|
|
struct tcp_pcb *lists[4] = { ctx->listen_pcbs, ctx->bound_pcbs, ctx->active_pcbs, ctx->tw_pcbs }; |
|
|
|
|
int i; |
|
|
|
|
lists[0] = ctx->listen_pcbs; lists[1] = ctx->bound_pcbs; |
|
|
|
|
lists[2] = ctx->active_pcbs; lists[3] = ctx->tw_pcbs; |
|
|
|
|
for (i = 0; i < 4; i++) { |
|
|
|
|
struct tcp_pcb *cpcb; |
|
|
|
|
for (cpcb = lists[i]; cpcb != NULL; cpcb = cpcb->next) { |
|
|
|
|
|