mirror of https://github.com/ARMmbed/mbed-os.git
lwip - Added check for previously-bound socket
Avoids what turns into an infinite loop in lwip's internalspull/2580/head
parent
9111aa4c2d
commit
c3130e51e4
|
@ -278,6 +278,11 @@ static int lwip_socket_bind(nsapi_stack_t *stack, nsapi_socket_t handle, nsapi_a
|
|||
return NSAPI_ERROR_PARAMETER;
|
||||
}
|
||||
|
||||
if ((s->conn->type == NETCONN_TCP && s->conn->pcb.tcp->local_port != 0) ||
|
||||
(s->conn->type == NETCONN_UDP && s->conn->pcb.udp->local_port != 0)) {
|
||||
return NSAPI_ERROR_PARAMETER;
|
||||
}
|
||||
|
||||
err_t err = netconn_bind(s->conn, (ip_addr_t *)addr.bytes, port);
|
||||
return lwip_err_remap(err);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue