OpenVPN
Data Structures | Macros | Typedefs | Enumerations | Functions
tun.h File Reference
#include <winioctl.h>
#include <tap-windows.h>
#include <setupapi.h>
#include <cfgmgr32.h>
#include "buffer.h"
#include "error.h"
#include "mtu.h"
#include "win32.h"
#include "event.h"
#include "proto.h"
#include "misc.h"
#include "networking.h"
#include "ring_buffer.h"
#include "dco.h"
Include dependency graph for tun.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  tuntap_options
 
struct  afunix_context
 
struct  tuntap
 
struct  tap_reg
 
struct  panel_reg
 
struct  device_instance_id_interface
 

Macros

#define WINTUN_COMPONENT_ID   "wintun"
 
#define DCO_WIN_REFERENCE_STRING   "ovpn-dco"
 
#define TUN_ADAPTER_INDEX_INVALID   ((DWORD)-1)
 
#define IPW32_SET_ADAPTIVE_DELAY_WINDOW   300
 
#define IPW32_SET_ADAPTIVE_TRY_NETSH   20
 
#define DHCP_OPTIONS_DHCP_OPTIONAL   (1<<0)
 
#define DHCP_OPTIONS_DHCP_REQUIRED   (1<<1)
 
#define IPW32_SET_MANUAL   0 /* "--ip-win32 manual" */
 
#define IPW32_SET_NETSH   1 /* "--ip-win32 netsh" */
 
#define IPW32_SET_IPAPI   2 /* "--ip-win32 ipapi" */
 
#define IPW32_SET_DHCP_MASQ   3 /* "--ip-win32 dynamic" */
 
#define IPW32_SET_ADAPTIVE   4 /* "--ip-win32 adaptive" */
 
#define IPW32_SET_N   5
 
#define N_DHCP_ADDR
 
#define N_SEARCH_LIST_LEN   10 /* Max # of entries in domin-search list */
 
#define TUNNEL_TYPE(tt)   ((tt) ? ((tt)->type) : DEV_TYPE_UNDEF)
 
#define TUNNEL_TOPOLOGY(tt)   ((tt) ? ((tt)->topology) : TOP_UNDEF)
 
#define IFCONFIG_BEFORE_TUN_OPEN   0
 
#define IFCONFIG_AFTER_TUN_OPEN   1
 
#define IFCONFIG_DEFAULT   IFCONFIG_AFTER_TUN_OPEN
 
#define ROUTE_BEFORE_TUN   0
 
#define ROUTE_AFTER_TUN   1
 
#define ROUTE_ORDER_DEFAULT   ROUTE_AFTER_TUN
 

Typedefs

typedef struct afunix_context afunix_context_t
 

Enumerations

enum  tun_driver_type {
  WINDOWS_DRIVER_UNSPECIFIED , WINDOWS_DRIVER_TAP_WINDOWS6 , WINDOWS_DRIVER_WINTUN , DRIVER_GENERIC_TUNTAP ,
  DRIVER_AFUNIX , DRIVER_NULL , DRIVER_DCO , DRIVER_UTUN
}
 

Functions

static bool tuntap_defined (const struct tuntap *tt)
 
static bool tuntap_is_wintun (struct tuntap *tt)
 
static bool tuntap_ring_empty (struct tuntap *tt)
 
void open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tuntap *tt, openvpn_net_ctx_t *ctx)
 
void close_tun (struct tuntap *tt, openvpn_net_ctx_t *ctx)
 
void tun_open_device (struct tuntap *tt, const char *dev_node, const char **device_guid, struct gc_arena *gc)
 
void close_tun_handle (struct tuntap *tt)
 
int write_tun (struct tuntap *tt, uint8_t *buf, int len)
 
int read_tun (struct tuntap *tt, uint8_t *buf, int len)
 
void tuncfg (const char *dev, const char *dev_type, const char *dev_node, int persist_mode, const char *username, const char *groupname, const struct tuntap_options *options, openvpn_net_ctx_t *ctx)
 
const char * guess_tuntap_dev (const char *dev, const char *dev_type, const char *dev_node, struct gc_arena *gc)
 
struct tuntapinit_tun (const char *dev, const char *dev_type, int topology, const char *ifconfig_local_parm, const char *ifconfig_remote_netmask_parm, const char *ifconfig_ipv6_local_parm, int ifconfig_ipv6_netbits_parm, const char *ifconfig_ipv6_remote_parm, struct addrinfo *local_public, struct addrinfo *remote_public, const bool strict_warn, struct env_set *es, openvpn_net_ctx_t *ctx, struct tuntap *tt)
 
void init_tun_post (struct tuntap *tt, const struct frame *frame, const struct tuntap_options *options)
 
void do_ifconfig_setenv (const struct tuntap *tt, struct env_set *es)
 
void do_ifconfig (struct tuntap *tt, const char *ifname, int tun_mtu, const struct env_set *es, openvpn_net_ctx_t *ctx)
 do_ifconfig - configure the tunnel interface
 
void undo_ifconfig (struct tuntap *tt, openvpn_net_ctx_t *ctx)
 undo_ifconfig - undo configuration of the tunnel interface
 
bool is_dev_type (const char *dev, const char *dev_type, const char *match_type)
 
int dev_type_enum (const char *dev, const char *dev_type)
 
const char * dev_type_string (const char *dev, const char *dev_type)
 
const char * ifconfig_options_string (const struct tuntap *tt, bool remote, bool disable, struct gc_arena *gc)
 
bool is_tun_p2p (const struct tuntap *tt)
 
void warn_on_use_of_common_subnets (openvpn_net_ctx_t *ctx)
 
const char * print_tun_backend_driver (enum tun_driver_type driver)
 Return a string representation of the tun backed driver type.
 
static int ifconfig_order (struct tuntap *tt)
 
static int route_order (struct tuntap *tt)
 
int ascii2ipset (const char *name)
 
const char * ipset2ascii (int index)
 
const char * ipset2ascii_all (struct gc_arena *gc)
 
void verify_255_255_255_252 (in_addr_t local, in_addr_t remote)
 
const IP_ADAPTER_INFO * get_adapter_info_list (struct gc_arena *gc)
 
const IP_ADAPTER_INFO * get_tun_adapter (const struct tuntap *tt, const IP_ADAPTER_INFO *list)
 
const IP_ADAPTER_INFO * get_adapter_info (DWORD index, struct gc_arena *gc)
 
const IP_PER_ADAPTER_INFO * get_per_adapter_info (const DWORD index, struct gc_arena *gc)
 
const IP_ADAPTER_INFO * get_adapter (const IP_ADAPTER_INFO *ai, DWORD index)
 
bool is_adapter_up (const struct tuntap *tt, const IP_ADAPTER_INFO *list)
 
bool is_ip_in_adapter_subnet (const IP_ADAPTER_INFO *ai, const in_addr_t ip, in_addr_t *highest_netmask)
 
DWORD adapter_index_of_ip (const IP_ADAPTER_INFO *list, const in_addr_t ip, int *count, in_addr_t *netmask)
 
void show_tap_win_adapters (int msglev, int warnlev)
 
void show_adapters (int msglev)
 
void tap_allow_nonadmin_access (const char *dev_node)
 
void show_valid_win32_tun_subnets (void)
 
const char * tap_win_getinfo (const struct tuntap *tt, struct gc_arena *gc)
 
void tun_show_debug (struct tuntap *tt)
 
bool dhcp_release_by_adapter_index (const DWORD adapter_index)
 
bool dhcp_renew_by_adapter_index (const DWORD adapter_index)
 
void fork_register_dns_action (struct tuntap *tt)
 
void ipconfig_register_dns (const struct env_set *es)
 
void tun_standby_init (struct tuntap *tt)
 
bool tun_standby (struct tuntap *tt)
 
int tun_read_queue (struct tuntap *tt, int maxsize)
 
int tun_write_queue (struct tuntap *tt, struct buffer *buf)
 
static bool tuntap_stop (int status)
 
static bool tuntap_abort (int status)
 
int tun_write_win32 (struct tuntap *tt, struct buffer *buf)
 
static ULONG wintun_ring_packet_align (ULONG size)
 
static ULONG wintun_ring_wrap (ULONG value)
 
static void read_wintun (struct tuntap *tt, struct buffer *buf)
 
static bool is_ip_packet_valid (const struct buffer *buf)
 
static int write_wintun (struct tuntap *tt, struct buffer *buf)
 
static int write_tun_buffered (struct tuntap *tt, struct buffer *buf)
 
static bool tuntap_is_dco_win (struct tuntap *tt)
 
static bool tuntap_is_dco_win_timeout (struct tuntap *tt, int status)
 
static event_t tun_event_handle (const struct tuntap *tt)
 
static void tun_set (struct tuntap *tt, struct event_set *es, unsigned int rwflags, void *arg, unsigned int *persistent)
 
const char * tun_stat (const struct tuntap *tt, unsigned int rwflags, struct gc_arena *gc)
 
bool tun_name_is_fixed (const char *dev)
 
static bool is_tun_type_set (const struct tuntap *tt)
 
static void open_tun_null (struct tuntap *tt)
 

Macro Definition Documentation

◆ DCO_WIN_REFERENCE_STRING

#define DCO_WIN_REFERENCE_STRING   "ovpn-dco"

Definition at line 62 of file tun.h.

◆ DHCP_OPTIONS_DHCP_OPTIONAL

#define DHCP_OPTIONS_DHCP_OPTIONAL   (1<<0)

Definition at line 74 of file tun.h.

◆ DHCP_OPTIONS_DHCP_REQUIRED

#define DHCP_OPTIONS_DHCP_REQUIRED   (1<<1)

Definition at line 75 of file tun.h.

◆ IFCONFIG_AFTER_TUN_OPEN

#define IFCONFIG_AFTER_TUN_OPEN   1

Definition at line 371 of file tun.h.

◆ IFCONFIG_BEFORE_TUN_OPEN

#define IFCONFIG_BEFORE_TUN_OPEN   0

Definition at line 370 of file tun.h.

◆ IFCONFIG_DEFAULT

#define IFCONFIG_DEFAULT   IFCONFIG_AFTER_TUN_OPEN

Definition at line 373 of file tun.h.

◆ IPW32_SET_ADAPTIVE

#define IPW32_SET_ADAPTIVE   4 /* "--ip-win32 adaptive" */

Definition at line 85 of file tun.h.

◆ IPW32_SET_ADAPTIVE_DELAY_WINDOW

#define IPW32_SET_ADAPTIVE_DELAY_WINDOW   300

Definition at line 70 of file tun.h.

◆ IPW32_SET_ADAPTIVE_TRY_NETSH

#define IPW32_SET_ADAPTIVE_TRY_NETSH   20

Definition at line 71 of file tun.h.

◆ IPW32_SET_DHCP_MASQ

#define IPW32_SET_DHCP_MASQ   3 /* "--ip-win32 dynamic" */

Definition at line 84 of file tun.h.

◆ IPW32_SET_IPAPI

#define IPW32_SET_IPAPI   2 /* "--ip-win32 ipapi" */

Definition at line 83 of file tun.h.

◆ IPW32_SET_MANUAL

#define IPW32_SET_MANUAL   0 /* "--ip-win32 manual" */

Definition at line 81 of file tun.h.

◆ IPW32_SET_N

#define IPW32_SET_N   5

Definition at line 86 of file tun.h.

◆ IPW32_SET_NETSH

#define IPW32_SET_NETSH   1 /* "--ip-win32 netsh" */

Definition at line 82 of file tun.h.

◆ N_DHCP_ADDR

#define N_DHCP_ADDR
Value:
4 /* Max # of addresses allowed for
* DNS, WINS, etc. */

Definition at line 111 of file tun.h.

◆ N_SEARCH_LIST_LEN

#define N_SEARCH_LIST_LEN   10 /* Max # of entries in domin-search list */

Definition at line 129 of file tun.h.

◆ ROUTE_AFTER_TUN

#define ROUTE_AFTER_TUN   1

Definition at line 402 of file tun.h.

◆ ROUTE_BEFORE_TUN

#define ROUTE_BEFORE_TUN   0

Definition at line 401 of file tun.h.

◆ ROUTE_ORDER_DEFAULT

#define ROUTE_ORDER_DEFAULT   ROUTE_AFTER_TUN

Definition at line 403 of file tun.h.

◆ TUN_ADAPTER_INDEX_INVALID

#define TUN_ADAPTER_INDEX_INVALID   ((DWORD)-1)

Definition at line 67 of file tun.h.

◆ TUNNEL_TOPOLOGY

#define TUNNEL_TOPOLOGY (   tt)    ((tt) ? ((tt)->topology) : TOP_UNDEF)

Definition at line 185 of file tun.h.

◆ TUNNEL_TYPE

#define TUNNEL_TYPE (   tt)    ((tt) ? ((tt)->type) : DEV_TYPE_UNDEF)

Definition at line 182 of file tun.h.

◆ WINTUN_COMPONENT_ID

#define WINTUN_COMPONENT_ID   "wintun"

Definition at line 61 of file tun.h.

Typedef Documentation

◆ afunix_context_t

Enumeration Type Documentation

◆ tun_driver_type

Enumerator
WINDOWS_DRIVER_UNSPECIFIED 
WINDOWS_DRIVER_TAP_WINDOWS6 
WINDOWS_DRIVER_WINTUN 
DRIVER_GENERIC_TUNTAP 
DRIVER_AFUNIX 

using an AF_UNIX socket to pass packets from/to an external program.

This is always defined. We error out if a user tries to open this type of backend on unsupported platforms.

DRIVER_NULL 
DRIVER_DCO 
DRIVER_UTUN 

macOS internal tun driver

Definition at line 45 of file tun.h.

Function Documentation

◆ adapter_index_of_ip()

DWORD adapter_index_of_ip ( const IP_ADAPTER_INFO *  list,
const in_addr_t  ip,
int *  count,
in_addr_t *  netmask 
)

◆ ascii2ipset()

int ascii2ipset ( const char *  name)

Definition at line 7009 of file tun.c.

References ASSERT, IPW32_SET_N, ipset_names::short_form, and SIZE.

Referenced by add_option().

◆ close_tun()

void close_tun ( struct tuntap tt,
openvpn_net_ctx_t ctx 
)

◆ close_tun_handle()

void close_tun_handle ( struct tuntap tt)

◆ dev_type_enum()

int dev_type_enum ( const char *  dev,
const char *  dev_type 
)

◆ dev_type_string()

const char * dev_type_string ( const char *  dev,
const char *  dev_type 
)

Definition at line 486 of file tun.c.

References dev_type_enum(), DEV_TYPE_TAP, and DEV_TYPE_TUN.

Referenced by do_open_tun(), open_tun_afunix(), and options_string().

◆ dhcp_release_by_adapter_index()

bool dhcp_release_by_adapter_index ( const DWORD  adapter_index)

Definition at line 5163 of file tun.c.

References D_TUNTAP_INFO, gc, gc_free(), gc_new(), get_interface_info(), M_WARN, msg, status, and strerror_win32().

Referenced by add_option(), and dhcp_release().

◆ dhcp_renew_by_adapter_index()

bool dhcp_renew_by_adapter_index ( const DWORD  adapter_index)

Definition at line 5203 of file tun.c.

References D_TUNTAP_INFO, gc, gc_free(), gc_new(), get_interface_info(), M_WARN, msg, status, and strerror_win32().

Referenced by add_option(), and dhcp_renew().

◆ do_ifconfig()

void do_ifconfig ( struct tuntap tt,
const char *  ifname,
int  tun_mtu,
const struct env_set es,
openvpn_net_ctx_t ctx 
)

do_ifconfig - configure the tunnel interface

Parameters
ttthe tuntap interface context
ifnamethe human readable interface name
tun_mtuthe MTU value to set the interface to
esthe environment to be used when executing the commands
ctxthe networking API opaque context

Definition at line 1606 of file tun.c.

References D_LOW, tuntap::did_ifconfig_ipv6_setup, tuntap::did_ifconfig_setup, do_ifconfig_ipv4(), do_ifconfig_ipv6(), es, tuntap::local, tuntap::local_ipv6, management_set_state(), msg, net_ctx_free(), and OPENVPN_STATE_ASSIGN_IP.

Referenced by do_open_tun().

◆ do_ifconfig_setenv()

void do_ifconfig_setenv ( const struct tuntap tt,
struct env_set es 
)

◆ fork_register_dns_action()

void fork_register_dns_action ( struct tuntap tt)

◆ get_adapter()

const IP_ADAPTER_INFO * get_adapter ( const IP_ADAPTER_INFO *  ai,
DWORD  index 
)

◆ get_adapter_info()

const IP_ADAPTER_INFO * get_adapter_info ( DWORD  index,
struct gc_arena gc 
)

Definition at line 4569 of file tun.c.

References gc, get_adapter(), and get_adapter_info_list().

Referenced by delete_temp_addresses(), dhcp_status(), and get_bypass_addresses().

◆ get_adapter_info_list()

const IP_ADAPTER_INFO * get_adapter_info_list ( struct gc_arena gc)

◆ get_per_adapter_info()

const IP_PER_ADAPTER_INFO * get_per_adapter_info ( const DWORD  index,
struct gc_arena gc 
)

◆ get_tun_adapter()

const IP_ADAPTER_INFO * get_tun_adapter ( const struct tuntap tt,
const IP_ADAPTER_INFO *  list 
)

Definition at line 4654 of file tun.c.

References tuntap::adapter_index, and get_adapter().

Referenced by is_adapter_up(), and windows_route_find_if_index().

◆ guess_tuntap_dev()

const char * guess_tuntap_dev ( const char *  dev,
const char *  dev_type,
const char *  dev_node,
struct gc_arena gc 
)

Definition at line 506 of file tun.c.

References dev_type_enum(), DEV_TYPE_TAP, DEV_TYPE_TUN, gc, and netsh_get_id().

Referenced by do_open_tun().

◆ ifconfig_options_string()

const char * ifconfig_options_string ( const struct tuntap tt,
bool  remote,
bool  disable,
struct gc_arena gc 
)

Definition at line 653 of file tun.c.

References alloc_buf_gc(), BSTR, buf_printf(), DEV_TYPE_TUN, gc, is_tun_p2p(), buffer::len, and print_in_addr_t().

Referenced by options_string().

◆ ifconfig_order()

static int ifconfig_order ( struct tuntap tt)
inlinestatic

◆ init_tun()

struct tuntap * init_tun ( const char *  dev,
const char *  dev_type,
int  topology,
const char *  ifconfig_local_parm,
const char *  ifconfig_remote_netmask_parm,
const char *  ifconfig_ipv6_local_parm,
int  ifconfig_ipv6_netbits_parm,
const char *  ifconfig_ipv6_remote_parm,
struct addrinfo *  local_public,
struct addrinfo *  remote_public,
const bool  strict_warn,
struct env_set es,
openvpn_net_ctx_t ctx,
struct tuntap tt 
)

◆ init_tun_post()

void init_tun_post ( struct tuntap tt,
const struct frame frame,
const struct tuntap_options options 
)

◆ ipconfig_register_dns()

void ipconfig_register_dns ( const struct env_set es)

◆ ipset2ascii()

const char * ipset2ascii ( int  index)

Definition at line 7024 of file tun.c.

References ASSERT, IPW32_SET_N, ipset_names::short_form, and SIZE.

Referenced by ipset2ascii_all().

◆ ipset2ascii_all()

const char * ipset2ascii_all ( struct gc_arena gc)

Definition at line 7038 of file tun.c.

References alloc_buf_gc(), ASSERT, BSTR, buf_printf(), gc, ipset2ascii(), IPW32_SET_N, buffer::len, and SIZE.

Referenced by add_option().

◆ is_adapter_up()

bool is_adapter_up ( const struct tuntap tt,
const IP_ADAPTER_INFO *  list 
)

◆ is_dev_type()

bool is_dev_type ( const char *  dev,
const char *  dev_type,
const char *  match_type 
)

Definition at line 449 of file tun.c.

References ASSERT.

Referenced by dev_type_enum(), and do_init_tun().

◆ is_ip_in_adapter_subnet()

bool is_ip_in_adapter_subnet ( const IP_ADAPTER_INFO *  ai,
const in_addr_t  ip,
in_addr_t *  highest_netmask 
)

◆ is_ip_packet_valid()

static bool is_ip_packet_valid ( const struct buffer buf)
inlinestatic

Definition at line 596 of file tun.h.

References BLEN, BPTR, OPENVPN_IPH_GET_VER, and openvpn_iphdr::version_len.

Referenced by write_wintun().

◆ is_tun_p2p()

bool is_tun_p2p ( const struct tuntap tt)

◆ is_tun_type_set()

static bool is_tun_type_set ( const struct tuntap tt)
inlinestatic

Definition at line 782 of file tun.h.

References DEV_TYPE_UNDEF, and tuntap::type.

Referenced by can_preserve_tun(), and do_close_tun().

◆ open_tun()

void open_tun ( const char *  dev,
const char *  dev_type,
const char *  dev_node,
struct tuntap tt,
openvpn_net_ctx_t ctx 
)

◆ open_tun_null()

static void open_tun_null ( struct tuntap tt)
inlinestatic

Definition at line 788 of file tun.h.

References tuntap::actual_name, and string_alloc().

Referenced by open_tun_backend().

◆ print_tun_backend_driver()

const char * print_tun_backend_driver ( enum tun_driver_type  driver)

◆ read_tun()

int read_tun ( struct tuntap tt,
uint8_t *  buf,
int  len 
)

Referenced by read_incoming_tun().

◆ read_wintun()

static void read_wintun ( struct tuntap tt,
struct buffer buf 
)
inlinestatic

◆ route_order()

static int route_order ( struct tuntap tt)
inlinestatic

Definition at line 406 of file tun.h.

References tuntap::backend_driver, DRIVER_AFUNIX, ROUTE_BEFORE_TUN, and ROUTE_ORDER_DEFAULT.

Referenced by do_open_tun(), and do_up().

◆ show_adapters()

void show_adapters ( int  msglev)

◆ show_tap_win_adapters()

void show_tap_win_adapters ( int  msglev,
int  warnlev 
)

◆ show_valid_win32_tun_subnets()

void show_valid_win32_tun_subnets ( void  )

Definition at line 4124 of file tun.c.

Referenced by add_option().

◆ tap_allow_nonadmin_access()

void tap_allow_nonadmin_access ( const char *  dev_node)

◆ tap_win_getinfo()

const char * tap_win_getinfo ( const struct tuntap tt,
struct gc_arena gc 
)

Definition at line 6770 of file tun.c.

References alloc_buf_gc(), tuntap::backend_driver, BCAP, BSTR, gc, buffer::len, and WINDOWS_DRIVER_TAP_WINDOWS6.

Referenced by print_status(), and x_check_status().

◆ tun_event_handle()

static event_t tun_event_handle ( const struct tuntap tt)
inlinestatic

Definition at line 738 of file tun.h.

References tuntap::rw_handle.

Referenced by tun_set().

◆ tun_name_is_fixed()

bool tun_name_is_fixed ( const char *  dev)

Definition at line 1830 of file tun.c.

References has_digit().

◆ tun_open_device()

void tun_open_device ( struct tuntap tt,
const char *  dev_node,
const char **  device_guid,
struct gc_arena gc 
)

◆ tun_read_queue()

int tun_read_queue ( struct tuntap tt,
int  maxsize 
)

◆ tun_set()

static void tun_set ( struct tuntap tt,
struct event_set es,
unsigned int  rwflags,
void *  arg,
unsigned int *  persistent 
)
inlinestatic

◆ tun_show_debug()

void tun_show_debug ( struct tuntap tt)

Definition at line 6788 of file tun.c.

References alloc_buf(), BCAP, BSTR, D_TAP_WIN_DEBUG, free_buf(), buffer::len, msg, and WINDOWS_DRIVER_TAP_WINDOWS6.

Referenced by pre_select().

◆ tun_standby()

bool tun_standby ( struct tuntap tt)

◆ tun_standby_init()

void tun_standby_init ( struct tuntap tt)

Definition at line 5734 of file tun.c.

References buffer::len.

Referenced by do_up().

◆ tun_stat()

const char * tun_stat ( const struct tuntap tt,
unsigned int  rwflags,
struct gc_arena gc 
)

◆ tun_write_queue()

int tun_write_queue ( struct tuntap tt,
struct buffer buf 
)

◆ tun_write_win32()

int tun_write_win32 ( struct tuntap tt,
struct buffer buf 
)

◆ tuncfg()

void tuncfg ( const char *  dev,
const char *  dev_type,
const char *  dev_node,
int  persist_mode,
const char *  username,
const char *  groupname,
const struct tuntap_options options,
openvpn_net_ctx_t ctx 
)

Referenced by do_persist_tuntap().

◆ tuntap_abort()

static bool tuntap_abort ( int  status)
inlinestatic

Definition at line 513 of file tun.h.

References status.

Referenced by read_incoming_tun().

◆ tuntap_defined()

static bool tuntap_defined ( const struct tuntap tt)
inlinestatic

◆ tuntap_is_dco_win()

static bool tuntap_is_dco_win ( struct tuntap tt)
inlinestatic

◆ tuntap_is_dco_win_timeout()

static bool tuntap_is_dco_win_timeout ( struct tuntap tt,
int  status 
)
inlinestatic

Definition at line 688 of file tun.h.

References openvpn_errno, status, and tuntap_is_dco_win().

Referenced by read_incoming_link().

◆ tuntap_is_wintun()

static bool tuntap_is_wintun ( struct tuntap tt)
inlinestatic

◆ tuntap_ring_empty()

static bool tuntap_ring_empty ( struct tuntap tt)
inlinestatic

◆ tuntap_stop()

static bool tuntap_stop ( int  status)
inlinestatic

Definition at line 499 of file tun.h.

References status.

Referenced by read_incoming_tun().

◆ undo_ifconfig()

void undo_ifconfig ( struct tuntap tt,
openvpn_net_ctx_t ctx 
)

undo_ifconfig - undo configuration of the tunnel interface

Parameters
ttthe tuntap interface context
ctxthe networking API opaque context

Definition at line 1705 of file tun.c.

References tuntap::backend_driver, tuntap::did_ifconfig_ipv6_setup, tuntap::did_ifconfig_setup, DRIVER_AFUNIX, DRIVER_NULL, net_ctx_reset(), undo_ifconfig_ipv4(), and undo_ifconfig_ipv6().

Referenced by do_close_tun_simple().

◆ verify_255_255_255_252()

void verify_255_255_255_252 ( in_addr_t  local,
in_addr_t  remote 
)

Definition at line 4087 of file tun.c.

References gc, gc_free(), gc_new(), M_FATAL, msg, and print_in_addr_t().

Referenced by init_tun().

◆ warn_on_use_of_common_subnets()

void warn_on_use_of_common_subnets ( openvpn_net_ctx_t ctx)

◆ wintun_ring_packet_align()

static ULONG wintun_ring_packet_align ( ULONG  size)
inlinestatic

Definition at line 528 of file tun.h.

References WINTUN_PACKET_ALIGN.

Referenced by read_wintun(), and write_wintun().

◆ wintun_ring_wrap()

static ULONG wintun_ring_wrap ( ULONG  value)
inlinestatic

Definition at line 534 of file tun.h.

References WINTUN_RING_CAPACITY.

Referenced by read_wintun(), and write_wintun().

◆ write_tun()

int write_tun ( struct tuntap tt,
uint8_t *  buf,
int  len 
)

Referenced by process_outgoing_tun().

◆ write_tun_buffered()

static int write_tun_buffered ( struct tuntap tt,
struct buffer buf 
)
inlinestatic

Definition at line 669 of file tun.h.

References tuntap::backend_driver, tun_write_win32(), WINDOWS_DRIVER_WINTUN, and write_wintun().

Referenced by process_outgoing_tun().

◆ write_wintun()

static int write_wintun ( struct tuntap tt,
struct buffer buf 
)
inlinestatic