Trivial changes from review of last PR
This commit is contained in:
parent
463268c531
commit
ad9321b7b7
@ -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);
|
||||
|
||||
|
@ -251,7 +251,8 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
|
||||
|
||||
#ifdef CONFIG_NET_TUN
|
||||
case NET_LL_TUN: /* Virtual Network Device (TUN) */
|
||||
dev->d_llhdrlen = 0; /* this will be overwritten by tun_ioctl if used as a TAP (layer 2) device */
|
||||
dev->d_llhdrlen = 0; /* This will be overwritten by tun_ioctl
|
||||
* if used as a TAP (layer 2) device */
|
||||
dev->d_mtu = CONFIG_NET_TUN_MTU;
|
||||
#ifdef CONFIG_NET_TCP
|
||||
dev->d_recvwndo = CONFIG_NET_TUN_TCP_RECVWNDO;
|
||||
|
Loading…
Reference in New Issue
Block a user