Network drivers: Fix bug in tun interface driver. From Max Neklyudov

This commit is contained in:
Max Neklyudov 2015-08-17 09:04:58 -06:00 committed by Gregory Nutt
parent 51f386d08a
commit 425146255a
4 changed files with 24 additions and 14 deletions

View File

@ -10831,4 +10831,5 @@
General the MS5805 altimeter driver to support other family
members and rename to ms58xx. From Paul Alexander Patience
(2015-08-14).
* Network drivers. Fix bug in tun interface driver. From Max
Neklyudov (2015-08-17).

View File

@ -9243,11 +9243,16 @@ detailed bugfix information):
NuttX-7.11 Release Notes
------------------------
The 111th release of NuttX, Version 7.11, was made on June 9, 2015,
The 111th release of NuttX, Version 7.11, was made on August 13 2015,
and is available for download from the Bitbucket.org website. Note
that release consists of two tarballs: nuttx-7.11.tar.gz and
apps-7.11.tar.gz. Both may be needed (see the top-level nuttx/README.txt
file for build information).
apps-7.11.tar.gz. These are available from:
https://bitbucket.org/patacongo/nuttx/downloads
https://bitbucket.org/nuttx/apps/downloads
Both may be needed (see the top-level nuttx/README.txt file for build
information).
Additional new features and extended functionality:

View File

@ -378,6 +378,7 @@ static int tun_txpoll(struct net_driver_s *dev)
{
/* Send the packet */
priv->read_d_len = priv->dev.d_len;
tun_transmit(priv);
return 1;
@ -511,7 +512,6 @@ static void tun_txdone(FAR struct tun_device_s *priv)
priv->dev.d_buf = priv->read_buf;
(void)devif_poll(&priv->dev, tun_txpoll);
priv->read_d_len = priv->dev.d_len;
}
/****************************************************************************
@ -537,14 +537,13 @@ static void tun_poll_process(FAR struct tun_device_s *priv)
* the TX poll if he are unable to accept another packet for transmission.
*/
/* If so, update TCP timing states and poll uIP for new XMIT data. Hmmm..
* might be bug here. Does this mean if there is a transmit in progress,
* we will missing TCP time state updates?
*/
if (priv->read_d_len == 0)
{
/* If so, poll uIP for new XMIT data. */
priv->dev.d_buf = priv->read_buf;
(void)devif_timer(&priv->dev, tun_txpoll, TUN_POLLHSEC);
priv->read_d_len = priv->dev.d_len;
priv->dev.d_buf = priv->read_buf;
(void)devif_timer(&priv->dev, tun_txpoll, TUN_POLLHSEC);
}
/* Setup the watchdog poll timer again */
@ -576,9 +575,13 @@ static void tun_poll_work(FAR void *arg)
/* Perform the poll */
tun_lock(priv);
state = net_lock();
tun_poll_process(priv);
net_unlock(state);
tun_unlock(priv);
}
#endif
@ -757,7 +760,6 @@ static int tun_txavail(struct net_driver_s *dev)
priv->dev.d_buf = priv->read_buf;
(void)devif_poll(&priv->dev, tun_txpoll);
priv->read_d_len = priv->dev.d_len;
}
net_unlock(state);

View File

@ -56,7 +56,9 @@
/* TUNSETIFF ifr flags */
#define IFF_TUN 0x0001
#define IFF_TUN 0x01
#define IFF_TAP 0x02
#define IFF_NO_PI 0x80
/****************************************************************************
* Public Type Definitions