Another TUN driver fix from Max Neklyudov

This commit is contained in:
Max Neklyudov 2015-08-21 07:39:57 -06:00 committed by Gregory Nutt
parent 2a81a76c33
commit 622c5c9aa6
3 changed files with 5 additions and 5 deletions

2
arch

@ -1 +1 @@
Subproject commit 29f7043bc649460e709f191fca47a0a026a50adb Subproject commit 76efd5e60a14c9e3b312b6f11c7c67de972a8299

View File

@ -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);

View File

@ -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
/**************************************************************************** /****************************************************************************