wireless/gs2200m: Fix handling of ioctl except SIOCDENYINETSOCK
When running a dual stack (usrsock daemon and kernel stack), ioctl requests that should be handled by the kernel stack are being processed by the usrsock daemon. This causes ifconfig and ifup to fail. The usrsock daemon that receives an ioctl request that should be handled by the kernel stack should reply with ENOTTY. Replying with ENOTTY means that the ioctl request can fall back to the kernel stack.
This commit is contained in:
parent
79e8722743
commit
7de8d0603f
@ -1563,6 +1563,7 @@ static int ioctl_request(int fd, FAR struct gs2200m_s *priv,
|
|||||||
struct gs2200m_ifreq_msg imsg;
|
struct gs2200m_ifreq_msg imsg;
|
||||||
uint8_t sock_type;
|
uint8_t sock_type;
|
||||||
bool getreq = false;
|
bool getreq = false;
|
||||||
|
bool drvreq = true;
|
||||||
int ret = -EINVAL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
memset(&imsg.ifr, 0, sizeof(imsg.ifr));
|
memset(&imsg.ifr, 0, sizeof(imsg.ifr));
|
||||||
@ -1575,14 +1576,29 @@ static int ioctl_request(int fd, FAR struct gs2200m_s *priv,
|
|||||||
case SIOCGIWNWID:
|
case SIOCGIWNWID:
|
||||||
case SIOCGIWFREQ:
|
case SIOCGIWFREQ:
|
||||||
case SIOCGIWSENS:
|
case SIOCGIWSENS:
|
||||||
getreq = true;
|
if (priv->usock_enable)
|
||||||
|
{
|
||||||
|
getreq = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = -ENOTTY;
|
||||||
|
drvreq = false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIOCSIFADDR:
|
case SIOCSIFADDR:
|
||||||
case SIOCSIFDSTADDR:
|
case SIOCSIFDSTADDR:
|
||||||
case SIOCSIFNETMASK:
|
case SIOCSIFNETMASK:
|
||||||
|
if (priv->usock_enable)
|
||||||
read(fd, &imsg.ifr, sizeof(imsg.ifr));
|
{
|
||||||
|
read(fd, &imsg.ifr, sizeof(imsg.ifr));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = -ENOTTY;
|
||||||
|
drvreq = false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIOCDENYINETSOCK:
|
case SIOCDENYINETSOCK:
|
||||||
@ -1604,11 +1620,19 @@ static int ioctl_request(int fd, FAR struct gs2200m_s *priv,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
if (!priv->usock_enable)
|
||||||
|
{
|
||||||
|
ret = -ENOTTY;
|
||||||
|
drvreq = false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
imsg.cmd = req->cmd;
|
if (drvreq)
|
||||||
ret = ioctl(priv->gsfd, GS2200M_IOC_IFREQ, (unsigned long)&imsg);
|
{
|
||||||
|
imsg.cmd = req->cmd;
|
||||||
|
ret = ioctl(priv->gsfd, GS2200M_IOC_IFREQ, (unsigned long)&imsg);
|
||||||
|
}
|
||||||
|
|
||||||
if (!getreq)
|
if (!getreq)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user