Skip to content

Commit 424ea9f

Browse files
mniestrojdleach02
authored andcommitted
drivers: wifi: esp_at: do not connect socket on bind(INADDR_ANY)
All connect() syscalls result in EISCONN error, since underlying _sock_connect() is attempted to be called twice. Once from net_context.c' bind_default() (with INADDR_ANY) as part of esp_bind() and second time as part of esp_connect(). Do not call _sock_connect() from esp_bind(INADDR_ANY), which happens as part of connect(). Fixes: dbf3d6e ("drivers: esp_at: implement bind() and recvfrom() for UDP sockets") Signed-off-by: Marcin Niestroj <[email protected]>
1 parent 79c3ba8 commit 424ea9f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/wifi/esp_at/esp_offload.c

+6
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,14 @@ static int esp_bind(struct net_context *context, const struct sockaddr *addr,
110110
}
111111

112112
if (IS_ENABLED(CONFIG_NET_IPV4) && addr->sa_family == AF_INET) {
113+
struct sockaddr_in *addr4 = (struct sockaddr_in *)addr;
114+
113115
LOG_DBG("link %d", sock->link_id);
114116

117+
if (addr4->sin_addr.s_addr == INADDR_ANY) {
118+
return 0;
119+
}
120+
115121
if (esp_socket_connected(sock)) {
116122
return -EISCONN;
117123
}

0 commit comments

Comments
 (0)