mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 19:36:35 +08:00
Another TUN driver fix from Max Neklyudov
This commit is contained in:
committed by
Gregory Nutt
parent
2a81a76c33
commit
622c5c9aa6
+1
-1
Submodule arch updated: 29f7043bc6...76efd5e60a
+3
-4
@@ -1178,8 +1178,8 @@ errout:
|
|||||||
|
|
||||||
static int tun_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
static int tun_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
FAR struct inode *inode = filep->f_inode;
|
FAR struct inode *inode = filep->f_inode;
|
||||||
FAR struct tun_driver_s *tun = inode->i_private;
|
FAR struct tun_driver_s *tun = inode->i_private;
|
||||||
FAR struct tun_device_s *priv = filep->f_priv;
|
FAR struct tun_device_s *priv = filep->f_priv;
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
|
|
||||||
@@ -1189,7 +1189,7 @@ static int tun_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
int intf;
|
int intf;
|
||||||
FAR struct ifreq *ifr = (FAR struct ifreq*)arg;
|
FAR struct ifreq *ifr = (FAR struct ifreq*)arg;
|
||||||
|
|
||||||
if (!ifr || ifr->ifr_flags != IFF_TUN)
|
if (!ifr || (ifr->ifr_flags & IFF_MASK) != IFF_TUN)
|
||||||
{
|
{
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@@ -1220,7 +1220,6 @@ static int tun_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
|
|
||||||
priv = filep->f_priv;
|
priv = filep->f_priv;
|
||||||
strncpy(ifr->ifr_name, priv->dev.d_ifname, IFNAMSIZ);
|
strncpy(ifr->ifr_name, priv->dev.d_ifname, IFNAMSIZ);
|
||||||
lldbg("--- %s\n", priv->dev.d_ifname);
|
|
||||||
|
|
||||||
tundev_unlock(tun);
|
tundev_unlock(tun);
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,7 @@
|
|||||||
|
|
||||||
#define IFF_TUN 0x01
|
#define IFF_TUN 0x01
|
||||||
#define IFF_TAP 0x02
|
#define IFF_TAP 0x02
|
||||||
|
#define IFF_MASK 0x7f
|
||||||
#define IFF_NO_PI 0x80
|
#define IFF_NO_PI 0x80
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
Reference in New Issue
Block a user