Trivial changes from review of last PR

This commit is contained in:
Gregory Nutt
2017-04-13 06:16:03 -06:00
parent 463268c531
commit ad9321b7b7
2 changed files with 12 additions and 2 deletions
+10 -1
View File
@@ -1159,7 +1159,12 @@ static int tun_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
int intf;
FAR struct ifreq *ifr = (FAR struct ifreq *)arg;
if (!ifr || ((ifr->ifr_flags & IFF_MASK) != IFF_TUN && (ifr->ifr_flags & IFF_MASK) != IFF_TAP))
#ifdef CONFIG_NET_MULTILINK
if (!ifr || ((ifr->ifr_flags & IFF_MASK) != IFF_TUN &&
(ifr->ifr_flags & IFF_MASK) != IFF_TAP))
#else
if (!ifr || (ifr->ifr_flags & IFF_MASK) != IFF_TUN)
#endif
{
return -EINVAL;
}
@@ -1191,11 +1196,13 @@ static int tun_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
priv = filep->f_priv;
strncpy(ifr->ifr_name, priv->dev.d_ifname, IFNAMSIZ);
#ifdef CONFIG_NET_MULTILINK
if ((ifr->ifr_flags & IFF_MASK) == IFF_TAP)
{
/* TAP device -> handling raw Ethernet packets
* -> set appropriate Ethernet header length
*/
priv->dev.d_llhdrlen = ETH_HDRLEN;
}
else if ((ifr->ifr_flags & IFF_MASK) == IFF_TUN)
@@ -1203,8 +1210,10 @@ static int tun_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
/* TUN device -> handling an application data stream
* -> no header
*/
priv->dev.d_llhdrlen = 0;
}
#endif
tundev_unlock(tun);