drivers: wifi: eswifi: Fully populate sockaddr_in on async msg
Updating the eswifi driver to provide port information (along with IP / net context) whenever an async message is received. This is needed to fully populate the "remote" info in "net_context" required whenever net_context_send is called. Also adding code to populate "remote" info in "net_context".. Tested with STM32 disco IOT kit. Fixes #25621 Signed-off-by: Bilal Wasim <bilalwasim676@gmail.com>
This commit is contained in:
parent
9d36b4f6e4
commit
64d5192f60
1 changed files with 9 additions and 1 deletions
|
@ -484,11 +484,19 @@ void eswifi_offload_async_msg(struct eswifi_dev *eswifi, char *msg, size_t len)
|
|||
return;
|
||||
}
|
||||
|
||||
sin_addr = &net_sin(&socket->peer_addr)->sin_addr;
|
||||
struct sockaddr_in *peer = net_sin(&socket->peer_addr);
|
||||
|
||||
sin_addr = &peer->sin_addr;
|
||||
memcpy(&sin_addr->s4_addr, ip, 4);
|
||||
peer->sin_port = htons(port);
|
||||
socket->state = ESWIFI_SOCKET_STATE_CONNECTED;
|
||||
socket->usage++;
|
||||
|
||||
/* Save information about remote. */
|
||||
socket->context->flags |= NET_CONTEXT_REMOTE_ADDR_SET;
|
||||
memcpy(&socket->context->remote, &socket->peer_addr,
|
||||
sizeof(struct sockaddr));
|
||||
|
||||
LOG_DBG("%u.%u.%u.%u connected to port %u",
|
||||
ip[0], ip[1], ip[2], ip[3], port);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue