wireless/gs2200m: Add support SIOCDENYINETSOCK ioctl command
Support SIOCDENYINETSOCK ioctl command to set usrsock status. If usock_enable is false, its means application wants to create a socket with other network stack.
This commit is contained in:
parent
dbdba4c254
commit
6a69f0e96f
@ -90,6 +90,7 @@ struct gs2200m_s
|
||||
uint8_t mode;
|
||||
uint8_t ch;
|
||||
int gsfd;
|
||||
int usock_enable;
|
||||
struct usock_s sockets[SOCKET_COUNT];
|
||||
};
|
||||
|
||||
@ -491,6 +492,16 @@ static int socket_request(int fd, FAR struct gs2200m_s *priv,
|
||||
{
|
||||
usockid = -EAFNOSUPPORT;
|
||||
}
|
||||
else if (!priv->usock_enable && req->domain == AF_INET &&
|
||||
req->type != SOCK_CTRL)
|
||||
{
|
||||
/* If domain is AF_INET while usock_enable is false,
|
||||
* set usockid to -ENOTSUP to fallback kernel
|
||||
* network stack.
|
||||
*/
|
||||
|
||||
usockid = -ENOTSUP;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Allocate socket. */
|
||||
@ -1550,6 +1561,7 @@ static int ioctl_request(int fd, FAR struct gs2200m_s *priv,
|
||||
struct usrsock_message_req_ack_s resp;
|
||||
struct usrsock_message_datareq_ack_s resp2;
|
||||
struct gs2200m_ifreq_msg imsg;
|
||||
uint8_t sock_type;
|
||||
bool getreq = false;
|
||||
int ret = -EINVAL;
|
||||
|
||||
@ -1573,6 +1585,24 @@ static int ioctl_request(int fd, FAR struct gs2200m_s *priv,
|
||||
read(fd, &imsg.ifr, sizeof(imsg.ifr));
|
||||
break;
|
||||
|
||||
case SIOCDENYINETSOCK:
|
||||
|
||||
read(fd, &sock_type, sizeof(uint8_t));
|
||||
|
||||
if (sock_type == DENY_INET_SOCK_ENABLE)
|
||||
{
|
||||
/* Block to create INET socket */
|
||||
|
||||
priv->usock_enable = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Allow to create INET socket */
|
||||
|
||||
priv->usock_enable = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1779,6 +1809,8 @@ int main(int argc, FAR char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
_daemon->usock_enable = TRUE;
|
||||
|
||||
if ((ap_mode && (4 != argc) && (5 != argc))
|
||||
|| (!ap_mode && 3 != argc))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user