From 620f33ba9f7a424521908b7b8a0886cd2cfa05de Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Mon, 12 Oct 2020 13:10:23 +0900 Subject: [PATCH] drivers: wireless: Fix to handle address info in accept() in gs2200m.c Summary: - This commit fixes to handle address info in accept() in gs2200m.c Impact: - All use cases which use accept() with gs2200m - Need to update apps/wireless/gs2200m as well Testing: - Tested with spresene:wifi - Tested with telnet daemon Signed-off-by: Masayuki Ishikawa > --- drivers/wireless/gs2200m.c | 11 +++++++++++ include/nuttx/wireless/gs2200m.h | 1 + 2 files changed, 12 insertions(+) diff --git a/drivers/wireless/gs2200m.c b/drivers/wireless/gs2200m.c index 551be8f6ea..24374bb9d6 100644 --- a/drivers/wireless/gs2200m.c +++ b/drivers/wireless/gs2200m.c @@ -2450,6 +2450,8 @@ static int gs2200m_ioctl_accept(FAR struct gs2200m_dev_s *dev, FAR struct gs2200m_accept_msg *msg) { FAR struct pkt_dat_s *pkt_dat; + struct gs2200m_name_msg nmsg; + enum pkt_type_e r; uint8_t c; char s_cid; char c_cid; @@ -2486,6 +2488,15 @@ static int gs2200m_ioctl_accept(FAR struct gs2200m_dev_s *dev, _notif_q_push(dev, c_cid); } + /* Obtain remote address info */ + + nmsg.local = 0; + nmsg.cid = msg->cid; + r = gs2200m_get_cstatus(dev, &nmsg); + ASSERT(TYPE_OK == r); + + msg->addr = nmsg.addr; + wlinfo("+++ end: type=%d (msg->cid=%c) \n", msg->type, msg->cid); return OK; diff --git a/include/nuttx/wireless/gs2200m.h b/include/nuttx/wireless/gs2200m.h index c1b9f14345..4dc9a59df5 100644 --- a/include/nuttx/wireless/gs2200m.h +++ b/include/nuttx/wireless/gs2200m.h @@ -94,6 +94,7 @@ struct gs2200m_bind_msg struct gs2200m_accept_msg { + struct sockaddr_in addr; char cid; uint8_t type; };