mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-07-02 19:08:57 +00:00
fixed bug #43110 (call getpeername() before listen() will cause a error) by re-sorting the error numbers and letting listen() continue on ERR_CONN
This commit is contained in:
parent
4335e99f2e
commit
3c40d93f36
|
@ -117,6 +117,10 @@ HISTORY
|
|||
|
||||
++ Bugfixes:
|
||||
|
||||
2014-09-02: Simon Goldschmidt
|
||||
* err.h/.c, sockets.c, api_msg.c: fixed bug #43110 call getpeername() before
|
||||
listen() will cause a error
|
||||
|
||||
2014-09-02: Simon Goldschmidt
|
||||
* sockets.c: fixed bug #42117 lwip_fcntl does not set errno
|
||||
|
||||
|
|
|
@ -1074,7 +1074,7 @@ lwip_netconn_do_disconnect(struct api_msg_msg *msg)
|
|||
void
|
||||
lwip_netconn_do_listen(struct api_msg_msg *msg)
|
||||
{
|
||||
if (ERR_IS_FATAL(msg->conn->last_err)) {
|
||||
if (ERR_IS_FATAL_LISTENCONNECT(msg->conn->last_err)) {
|
||||
msg->err = msg->conn->last_err;
|
||||
} else {
|
||||
msg->err = ERR_CONN;
|
||||
|
@ -1082,6 +1082,10 @@ lwip_netconn_do_listen(struct api_msg_msg *msg)
|
|||
if (NETCONNTYPE_GROUP(msg->conn->type) == NETCONN_TCP) {
|
||||
if (msg->conn->state == NETCONN_NONE) {
|
||||
struct tcp_pcb* lpcb;
|
||||
if (msg->conn->pcb.tcp->state != CLOSED) {
|
||||
/* connection is not closed, cannot listen */
|
||||
msg->err = ERR_VAL;
|
||||
} else {
|
||||
#if LWIP_IPV6
|
||||
if ((msg->conn->flags & NETCONN_FLAG_IPV6_V6ONLY) == 0) {
|
||||
#if TCP_LISTEN_BACKLOG
|
||||
|
@ -1124,6 +1128,7 @@ lwip_netconn_do_listen(struct api_msg_msg *msg)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
msg->err = ERR_ARG;
|
||||
}
|
||||
|
|
|
@ -51,10 +51,10 @@ static const char *err_strerr[] = {
|
|||
"Operation would block.", /* ERR_WOULDBLOCK -7 */
|
||||
"Address in use.", /* ERR_USE -8 */
|
||||
"Already connected.", /* ERR_ISCONN -9 */
|
||||
"Connection aborted.", /* ERR_ABRT -10 */
|
||||
"Connection reset.", /* ERR_RST -11 */
|
||||
"Connection closed.", /* ERR_CLSD -12 */
|
||||
"Not connected.", /* ERR_CONN -13 */
|
||||
"Not connected.", /* ERR_CONN -10 */
|
||||
"Connection aborted.", /* ERR_ABRT -11 */
|
||||
"Connection reset.", /* ERR_RST -12 */
|
||||
"Connection closed.", /* ERR_CLSD -13 */
|
||||
"Illegal argument.", /* ERR_ARG -14 */
|
||||
"Low-level netif error.", /* ERR_IF -15 */
|
||||
};
|
||||
|
|
|
@ -208,10 +208,10 @@ static const int err_to_errno_table[] = {
|
|||
EWOULDBLOCK, /* ERR_WOULDBLOCK -7 Operation would block. */
|
||||
EADDRINUSE, /* ERR_USE -8 Address in use. */
|
||||
EALREADY, /* ERR_ISCONN -9 Already connected. */
|
||||
ECONNABORTED, /* ERR_ABRT -10 Connection aborted. */
|
||||
ECONNRESET, /* ERR_RST -11 Connection reset. */
|
||||
ENOTCONN, /* ERR_CLSD -12 Connection closed. */
|
||||
ENOTCONN, /* ERR_CONN -13 Not connected. */
|
||||
ENOTCONN, /* ERR_CONN -10 Not connected. */
|
||||
ECONNABORTED, /* ERR_ABRT -11 Connection aborted. */
|
||||
ECONNRESET, /* ERR_RST -12 Connection reset. */
|
||||
ENOTCONN, /* ERR_CLSD -13 Connection closed. */
|
||||
EIO, /* ERR_ARG -14 Illegal argument. */
|
||||
-1, /* ERR_IF -15 Low-level netif error */
|
||||
};
|
||||
|
|
|
@ -62,10 +62,12 @@ typedef s8_t err_t;
|
|||
|
||||
#define ERR_IS_FATAL(e) ((e) < ERR_ISCONN)
|
||||
|
||||
#define ERR_ABRT -10 /* Connection aborted. */
|
||||
#define ERR_RST -11 /* Connection reset. */
|
||||
#define ERR_CLSD -12 /* Connection closed. */
|
||||
#define ERR_CONN -13 /* Not connected. */
|
||||
#define ERR_CONN -10 /* Not connected. */
|
||||
#define ERR_IS_FATAL_LISTENCONNECT(e) ((e) < ERR_CONN)
|
||||
|
||||
#define ERR_ABRT -11 /* Connection aborted. */
|
||||
#define ERR_RST -12 /* Connection reset. */
|
||||
#define ERR_CLSD -13 /* Connection closed. */
|
||||
|
||||
#define ERR_ARG -14 /* Illegal argument. */
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user