mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 21:36:28 +08:00
Move TUN ioctl commnd to include/nuttx/net/ioctl.h so that it will always be unique. It a error in netdev_register: it was not handling device names properly when TUN is the only network device.
This commit is contained in:
+1
-1
@@ -1155,7 +1155,7 @@ static int tun_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
FAR struct tun_device_s *priv = filep->f_priv;
|
FAR struct tun_device_s *priv = filep->f_priv;
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
|
|
||||||
if (cmd == TUNSETIFF && !priv)
|
if (cmd == TUNSETIFF && priv == NULL)
|
||||||
{
|
{
|
||||||
uint8_t free_tuns;
|
uint8_t free_tuns;
|
||||||
int intf;
|
int intf;
|
||||||
|
|||||||
@@ -119,9 +119,13 @@
|
|||||||
#define SIOCINQ _SIOC(0x0025) /* Returns the amount of queued unread
|
#define SIOCINQ _SIOC(0x0025) /* Returns the amount of queued unread
|
||||||
* data in the receive */
|
* data in the receive */
|
||||||
|
|
||||||
|
/* TUN/TAP driver ***********************************************************/
|
||||||
|
|
||||||
|
#define TUNSETIFF _SIOC(0x0026) /* Set TUN/TAP interface */
|
||||||
|
|
||||||
/* Telnet driver ************************************************************/
|
/* Telnet driver ************************************************************/
|
||||||
|
|
||||||
#define SIOCTELNET _SIOC(0x0026) /* Create a Telnet sessions.
|
#define SIOCTELNET _SIOC(0x0027) /* Create a Telnet sessions.
|
||||||
* See include/nuttx/net/telnet.h */
|
* See include/nuttx/net/telnet.h */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -52,8 +52,6 @@
|
|||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define TUNSETIFF _SIOC(0x1001)
|
|
||||||
|
|
||||||
/* TUNSETIFF ifr flags */
|
/* TUNSETIFF ifr flags */
|
||||||
|
|
||||||
#define IFF_TUN 0x01
|
#define IFF_TUN 0x01
|
||||||
@@ -85,12 +83,12 @@ extern "C"
|
|||||||
* Name: tun_initialize
|
* Name: tun_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Instantiate a SLIP network interface.
|
* Instantiate a TUN network interface.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* OK on success; Negated errno on failure.
|
* OK on success; Negated errno value on failure.
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -68,14 +68,16 @@
|
|||||||
#define NETDEV_WLAN_FORMAT "wlan%d"
|
#define NETDEV_WLAN_FORMAT "wlan%d"
|
||||||
#define NETDEV_WPAN_FORMAT "wpan%d"
|
#define NETDEV_WPAN_FORMAT "wpan%d"
|
||||||
|
|
||||||
#if defined(CONFIG_NET_SLIP)
|
#if defined(CONFIG_DRIVERS_IEEE80211) /* Usually also has CONFIG_NET_ETHERNET */
|
||||||
# define NETDEV_DEFAULT_FORMAT NETDEV_SLIP_FORMAT
|
|
||||||
#elif defined(CONFIG_DRIVERS_IEEE80211) /* Usually also has CONFIG_NET_ETHERNET */
|
|
||||||
# define NETDEV_DEFAULT_FORMAT NETDEV_WLAN_FORMAT
|
# define NETDEV_DEFAULT_FORMAT NETDEV_WLAN_FORMAT
|
||||||
#elif defined(CONFIG_NET_ETHERNET)
|
#elif defined(CONFIG_NET_ETHERNET)
|
||||||
# define NETDEV_DEFAULT_FORMAT NETDEV_ETH_FORMAT
|
# define NETDEV_DEFAULT_FORMAT NETDEV_ETH_FORMAT
|
||||||
#elif defined(CONFIG_NET_6LOWPAN)
|
#elif defined(CONFIG_NET_6LOWPAN)
|
||||||
# define NETDEV_DEFAULT_FORMAT NETDEV_WPAN_FORMAT
|
# define NETDEV_DEFAULT_FORMAT NETDEV_WPAN_FORMAT
|
||||||
|
#elif defined(CONFIG_NET_SLIP)
|
||||||
|
# define NETDEV_DEFAULT_FORMAT NETDEV_SLIP_FORMAT
|
||||||
|
#elif defined(CONFIG_NET_TUN)
|
||||||
|
# define NETDEV_DEFAULT_FORMAT NETDEV_TUN_FORMAT
|
||||||
#else /* if defined(CONFIG_NET_LOOPBACK) */
|
#else /* if defined(CONFIG_NET_LOOPBACK) */
|
||||||
# define NETDEV_DEFAULT_FORMAT NETDEV_LO_FORMAT
|
# define NETDEV_DEFAULT_FORMAT NETDEV_LO_FORMAT
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user