OpenVPN
Data Structures | Macros | 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  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
 

Enumerations

enum  windows_driver_type { WINDOWS_DRIVER_UNSPECIFIED, WINDOWS_DRIVER_TAP_WINDOWS6, WINDOWS_DRIVER_WINTUN, WINDOWS_DRIVER_DCO }
 

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 More...
 
void undo_ifconfig (struct tuntap *tt, openvpn_net_ctx_t *ctx)
 undo_ifconfig - undo configuration of the tunnel interface More...
 
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 check_subnet_conflict (const in_addr_t ip, const in_addr_t netmask, const char *prefix)
 
void warn_on_use_of_common_subnets (openvpn_net_ctx_t *ctx)
 
static int ifconfig_order (void)
 
static int route_order (void)
 
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)
 
const char * print_windows_driver (enum windows_driver_type windows_driver)
 
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)
 

Macro Definition Documentation

◆ DCO_WIN_REFERENCE_STRING

#define DCO_WIN_REFERENCE_STRING   "ovpn-dco"

Definition at line 47 of file tun.h.

◆ DHCP_OPTIONS_DHCP_OPTIONAL

#define DHCP_OPTIONS_DHCP_OPTIONAL   (1<<0)

Definition at line 66 of file tun.h.

◆ DHCP_OPTIONS_DHCP_REQUIRED

#define DHCP_OPTIONS_DHCP_REQUIRED   (1<<1)

Definition at line 67 of file tun.h.

◆ IFCONFIG_AFTER_TUN_OPEN

#define IFCONFIG_AFTER_TUN_OPEN   1

Definition at line 353 of file tun.h.

◆ IFCONFIG_BEFORE_TUN_OPEN

#define IFCONFIG_BEFORE_TUN_OPEN   0

Definition at line 352 of file tun.h.

◆ IFCONFIG_DEFAULT

#define IFCONFIG_DEFAULT   IFCONFIG_AFTER_TUN_OPEN

Definition at line 355 of file tun.h.

◆ IPW32_SET_ADAPTIVE

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

Definition at line 79 of file tun.h.

◆ IPW32_SET_ADAPTIVE_DELAY_WINDOW

#define IPW32_SET_ADAPTIVE_DELAY_WINDOW   300

Definition at line 62 of file tun.h.

◆ IPW32_SET_ADAPTIVE_TRY_NETSH

#define IPW32_SET_ADAPTIVE_TRY_NETSH   20

Definition at line 63 of file tun.h.

◆ IPW32_SET_DHCP_MASQ

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

Definition at line 78 of file tun.h.

◆ IPW32_SET_IPAPI

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

Definition at line 77 of file tun.h.

◆ IPW32_SET_MANUAL

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

Definition at line 75 of file tun.h.

◆ IPW32_SET_N

#define IPW32_SET_N   5

Definition at line 80 of file tun.h.

◆ IPW32_SET_NETSH

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

Definition at line 76 of file tun.h.

◆ N_DHCP_ADDR

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

Definition at line 105 of file tun.h.

◆ N_SEARCH_LIST_LEN

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

Definition at line 123 of file tun.h.

◆ ROUTE_AFTER_TUN

#define ROUTE_AFTER_TUN   1

Definition at line 380 of file tun.h.

◆ ROUTE_BEFORE_TUN

#define ROUTE_BEFORE_TUN   0

Definition at line 379 of file tun.h.

◆ ROUTE_ORDER_DEFAULT

#define ROUTE_ORDER_DEFAULT   ROUTE_AFTER_TUN

Definition at line 381 of file tun.h.

◆ TUN_ADAPTER_INDEX_INVALID

#define TUN_ADAPTER_INDEX_INVALID   ((DWORD)-1)

Definition at line 59 of file tun.h.

◆ TUNNEL_TOPOLOGY

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

Definition at line 176 of file tun.h.

◆ TUNNEL_TYPE

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

Definition at line 173 of file tun.h.

◆ WINTUN_COMPONENT_ID

#define WINTUN_COMPONENT_ID   "wintun"

Definition at line 46 of file tun.h.

Enumeration Type Documentation

◆ windows_driver_type

Enumerator
WINDOWS_DRIVER_UNSPECIFIED 
WINDOWS_DRIVER_TAP_WINDOWS6 
WINDOWS_DRIVER_WINTUN 
WINDOWS_DRIVER_DCO 

Definition at line 49 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 7098 of file tun.c.

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

Referenced by add_option().

◆ check_subnet_conflict()

void check_subnet_conflict ( const in_addr_t  ip,
const in_addr_t  netmask,
const char *  prefix 
)

Definition at line 611 of file tun.c.

References gc_free(), gc_new(), get_default_gateway(), M_WARN, msg, and print_in_addr_t().

Referenced by add_routes(), and init_tun().

◆ 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 457 of file tun.c.

References dev_type_enum(), DEV_TYPE_NULL, DEV_TYPE_TAP, and DEV_TYPE_TUN.

Referenced by do_open_tun(), and options_string().

◆ dhcp_release_by_adapter_index()

bool dhcp_release_by_adapter_index ( const DWORD  adapter_index)

Definition at line 5246 of file tun.c.

References D_TUNTAP_INFO, 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 5286 of file tun.c.

References D_TUNTAP_INFO, 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
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 1650 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 4652 of file tun.c.

References 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 4737 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 480 of file tun.c.

References dev_type_enum(), DEV_TYPE_TAP, DEV_TYPE_TUN, argv::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 
)

◆ ifconfig_order()

static int ifconfig_order ( void  )
inlinestatic

Definition at line 358 of file tun.h.

References IFCONFIG_AFTER_TUN_OPEN, IFCONFIG_BEFORE_TUN_OPEN, and IFCONFIG_DEFAULT.

Referenced by do_open_tun().

◆ 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 7113 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 7127 of file tun.c.

References alloc_buf_gc(), ASSERT, BSTR, buf_printf(), ipset2ascii(), IPW32_SET_N, 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 418 of file tun.c.

References ASSERT.

Referenced by dev_type_enum().

◆ 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 570 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 759 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 
)

◆ print_windows_driver()

const char* print_windows_driver ( enum windows_driver_type  windows_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 ( void  )
inlinestatic

Definition at line 384 of file tun.h.

References 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 4207 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 
)

◆ tun_event_handle()

static event_t tun_event_handle ( const struct tuntap tt)
inlinestatic

Definition at line 715 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 1881 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)

◆ tun_standby()

bool tun_standby ( struct tuntap tt)

◆ tun_standby_init()

void tun_standby_init ( struct tuntap tt)

Definition at line 5817 of file tun.c.

References tuntap::standby_iter.

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 487 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 662 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

Definition at line 249 of file tun.h.

References tuntap::windows_driver, and WINDOWS_DRIVER_WINTUN.

Referenced by io_wait(), io_wait_dowork(), multi_tcp_wait(), and tuntap_ring_empty().

◆ tuntap_ring_empty()

static bool tuntap_ring_empty ( struct tuntap tt)
inlinestatic

◆ tuntap_stop()

static bool tuntap_stop ( int  status)
inlinestatic

Definition at line 473 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 1749 of file tun.c.

References DEV_TYPE_NULL, tuntap::did_ifconfig_ipv6_setup, tuntap::did_ifconfig_setup, net_ctx_reset(), tuntap::type, 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 4170 of file tun.c.

References gc_free(), gc_new(), M_FATAL, msg, PACKAGE, 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 502 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 508 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 643 of file tun.h.

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

Referenced by process_outgoing_tun().

◆ write_wintun()

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