diff --git a/src/api/api_msg.c b/src/api/api_msg.c index f12c0059..14f1a8e7 100644 --- a/src/api/api_msg.c +++ b/src/api/api_msg.c @@ -1288,7 +1288,7 @@ lwip_netconn_do_listen(struct api_msg_msg *msg) /* "Socket API like" dual-stack support: If IP to listen to is IP6_ADDR_ANY, * and NETCONN_FLAG_IPV6_V6ONLY is NOT set, use IP_ANY_TYPE to listen */ - if (ip_addr_cmp(API_EXPR_REF(msg->msg.bc.ipaddr), IP6_ADDR_ANY) && + if (ip_addr_cmp(&msg->conn->pcb.ip->local_ip, IP6_ADDR_ANY) && ((msg->conn->flags & NETCONN_FLAG_IPV6_V6ONLY) == 0)) { /* change PCB type to IPADDR_TYPE_ANY */ IP_SET_TYPE_VAL(msg->conn->pcb.tcp->local_ip, IPADDR_TYPE_ANY);