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: dbf3d6e911
("drivers: esp_at: implement bind() and recvfrom() for
UDP sockets")
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
This commit is contained in:
parent
79c3ba802a
commit
424ea9f5e4
1 changed files with 6 additions and 0 deletions
|
@ -110,8 +110,14 @@ static int esp_bind(struct net_context *context, const struct sockaddr *addr,
|
|||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_NET_IPV4) && addr->sa_family == AF_INET) {
|
||||
struct sockaddr_in *addr4 = (struct sockaddr_in *)addr;
|
||||
|
||||
LOG_DBG("link %d", sock->link_id);
|
||||
|
||||
if (addr4->sin_addr.s_addr == INADDR_ANY) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (esp_socket_connected(sock)) {
|
||||
return -EISCONN;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue