OpenVPN
|
#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"
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 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) |
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) |
#define IFCONFIG_DEFAULT IFCONFIG_AFTER_TUN_OPEN |
#define N_DHCP_ADDR |
#define N_SEARCH_LIST_LEN 10 /* Max # of entries in domin-search list */ |
#define ROUTE_ORDER_DEFAULT ROUTE_AFTER_TUN |
#define TUNNEL_TOPOLOGY | ( | tt | ) | ((tt) ? ((tt)->topology) : TOP_UNDEF) |
#define TUNNEL_TYPE | ( | tt | ) | ((tt) ? ((tt)->type) : DEV_TYPE_UNDEF) |
enum windows_driver_type |
DWORD adapter_index_of_ip | ( | const IP_ADAPTER_INFO * | list, |
const in_addr_t | ip, | ||
int * | count, | ||
in_addr_t * | netmask | ||
) |
Definition at line 4828 of file tun.c.
References D_ROUTE_DEBUG, dmsg, gc_free(), gc_new(), get_interface_metric(), is_ip_in_adapter_subnet(), gc_arena::list, print_in_addr_t(), and TUN_ADAPTER_INDEX_INVALID.
Referenced by get_default_gateway(), and test_route().
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().
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().
void close_tun | ( | struct tuntap * | tt, |
openvpn_net_ctx_t * | ctx | ||
) |
Definition at line 6995 of file tun.c.
References tuntap::actual_name, ASSERT, clear_tuntap(), close_tun_handle(), delete_route_connected_v6_net(), dhcp_release(), tuntap::did_ifconfig_ipv6_setup, tuntap::did_ifconfig_setup, do_address_service(), do_dns_domain_service(), do_dns_domain_wmic(), do_dns_service(), do_wins_service(), gc_free(), gc_new(), tuntap_options::ip_win32_type, tuntap::ipapi_context, tuntap::ipapi_context_defined, IPW32_SET_ADAPTIVE, IPW32_SET_DHCP_MASQ, IPW32_SET_MANUAL, IPW32_SET_NETSH, M_WARN, msg, tuntap_options::msg_channel, netsh_delete_address_dns(), tuntap::options, status, and strerror_win32().
Referenced by do_close_tun_simple().
void close_tun_handle | ( | struct tuntap * | tt | ) |
Definition at line 6954 of file tun.c.
References D_WIN32_IO_LOW, dmsg, tuntap::hand, M_ERRNO, M_WARN, msg, overlapped_io_close(), print_windows_driver(), rw_handle::read, tuntap::reads, tuntap::rw_handle, tuntap::windows_driver, WINDOWS_DRIVER_WINTUN, tuntap::wintun_receive_ring, tuntap::wintun_receive_ring_handle, tuntap::wintun_send_ring, tuntap::wintun_send_ring_handle, rw_handle::write, and tuntap::writes.
Referenced by close_tun().
int dev_type_enum | ( | const char * | dev, |
const char * | dev_type | ||
) |
Definition at line 436 of file tun.c.
References DEV_TYPE_NULL, DEV_TYPE_TAP, DEV_TYPE_TUN, DEV_TYPE_UNDEF, and is_dev_type().
Referenced by dev_type_string(), do_init_route_list(), do_persist_tuntap(), guess_tuntap_dev(), helper_client_server(), helper_setdefault_topology(), init_tun(), multi_init(), options_postprocess_mutate_ce(), options_postprocess_mutate_invariant(), and options_postprocess_verify_ce().
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().
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().
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().
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
tt | the tuntap interface context |
ifname | the human readable interface name |
mtu | the MTU value to set the interface to |
es | the environment to be used when executing the commands |
ctx | the 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().
Definition at line 764 of file tun.c.
References tuntap::did_ifconfig_ipv6_setup, tuntap::did_ifconfig_setup, es, gc_free(), gc_new(), is_tun_p2p(), tuntap::local, tuntap::local_ipv6, tuntap::netbits_ipv6, print_in6_addr(), print_in_addr_t(), tuntap::remote_ipv6, tuntap::remote_netmask, setenv_int(), and setenv_str().
Referenced by do_open_tun(), and init_tun().
void fork_register_dns_action | ( | struct tuntap * | tt | ) |
Definition at line 6130 of file tun.c.
References alloc_buf_gc(), BSTR, buf_printf(), fork_to_self(), gc_free(), gc_new(), tuntap_options::msg_channel, tuntap::options, tuntap_options::register_dns, and register_dns_service().
Referenced by initialization_sequence_completed().
const IP_ADAPTER_INFO* get_adapter | ( | const IP_ADAPTER_INFO * | ai, |
DWORD | index | ||
) |
Definition at line 4633 of file tun.c.
References TUN_ADAPTER_INDEX_INVALID.
Referenced by get_adapter_info(), get_default_gateway(), get_tun_adapter(), and netsh_ifconfig().
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().
const IP_ADAPTER_INFO* get_adapter_info_list | ( | struct gc_arena * | gc | ) |
Definition at line 4519 of file tun.c.
References gc_malloc(), M_INFO, msg, status, and strerror_win32().
Referenced by get_adapter_index_method_2(), get_adapter_info(), get_default_gateway(), netsh_ifconfig(), show_adapters(), test_routes(), and windows_route_find_if_index().
const IP_PER_ADAPTER_INFO* get_per_adapter_info | ( | const DWORD | index, |
struct gc_arena * | gc | ||
) |
Definition at line 4546 of file tun.c.
References gc_malloc(), M_INFO, msg, status, strerror_win32(), and TUN_ADAPTER_INDEX_INVALID.
Referenced by get_bypass_addresses(), netsh_ifconfig(), and show_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().
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().
const char* ifconfig_options_string | ( | const struct tuntap * | tt, |
bool | remote, | ||
bool | disable, | ||
struct gc_arena * | gc | ||
) |
Definition at line 665 of file tun.c.
References alloc_buf_gc(), BSTR, buf_printf(), DEV_TYPE_TAP, DEV_TYPE_TUN, tuntap::did_ifconfig_setup, tuntap::local, print_in_addr_t(), tuntap::remote_netmask, TOP_SUBNET, tuntap::topology, and tuntap::type.
Referenced by options_string().
|
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().
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 | ||
) |
Definition at line 808 of file tun.c.
References tuntap::adapter_netmask, ALLOC_OBJ, check_addr_clash(), check_subnet_conflict(), clear_tuntap(), dev_type_enum(), DEV_TYPE_TAP, DEV_TYPE_TUN, tuntap::did_ifconfig_ipv6_setup, tuntap::did_ifconfig_setup, do_ifconfig_setenv(), es, getaddr(), GETADDR_FATAL, GETADDR_FATAL_ON_SIGNAL, GETADDR_HOST_ORDER, GETADDR_RESOLVE, ifconfig_sanity_check(), IPV4_NETMASK_HOST, is_tun_p2p(), tuntap::local, tuntap::local_ipv6, M_FATAL, msg, tuntap::netbits_ipv6, tuntap::remote_ipv6, tuntap::remote_netmask, TOP_SUBNET, tuntap::topology, tuntap::type, and verify_255_255_255_252().
Referenced by do_init_tun(), and options_string().
void init_tun_post | ( | struct tuntap * | tt, |
const struct frame * | frame, | ||
const struct tuntap_options * | options | ||
) |
Definition at line 963 of file tun.c.
References tuntap::adapter_index, dco_start_tun(), M_FATAL, msg, tuntap::options, overlapped_io::overlapped, overlapped_io_init(), rw_handle::read, tuntap::reads, tuntap::rw_handle, TUN_ADAPTER_INDEX_INVALID, tuntap::windows_driver, WINDOWS_DRIVER_DCO, WINDOWS_DRIVER_WINTUN, tuntap::wintun_receive_ring_handle, tuntap::wintun_send_ring_handle, rw_handle::write, and tuntap::writes.
Referenced by do_init_tun().
void ipconfig_register_dns | ( | const struct env_set * | es | ) |
Definition at line 5352 of file tun.c.
References argv_free(), argv_msg(), argv_new(), argv_printf(), D_TUNTAP_INFO, es, get_win_sys_path(), msg, netcmd_semaphore_lock(), netcmd_semaphore_release(), openvpn_execve_check(), and WIN_IPCONFIG_PATH_SUFFIX.
Referenced by add_option().
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().
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().
bool is_adapter_up | ( | const struct tuntap * | tt, |
const IP_ADAPTER_INFO * | list | ||
) |
Definition at line 4750 of file tun.c.
References tuntap::adapter_netmask, get_adapter_ip_netmask(), get_adapter_n_ip_netmask(), get_tun_adapter(), and tuntap::local.
Referenced by test_routes().
bool is_dev_type | ( | const char * | dev, |
const char * | dev_type, | ||
const char * | match_type | ||
) |
bool is_ip_in_adapter_subnet | ( | const IP_ADAPTER_INFO * | ai, |
const in_addr_t | ip, | ||
in_addr_t * | highest_netmask | ||
) |
Definition at line 4795 of file tun.c.
References get_adapter_ip_netmask(), and get_adapter_n_ip_netmask().
Referenced by adapter_index_of_ip(), and windows_route_find_if_index().
|
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().
bool is_tun_p2p | ( | const struct tuntap * | tt | ) |
Definition at line 738 of file tun.c.
References DEV_TYPE_NULL, DEV_TYPE_TAP, DEV_TYPE_TUN, M_FATAL, msg, TOP_SUBNET, tuntap::topology, and tuntap::type.
Referenced by do_ifconfig_ipv4(), do_ifconfig_setenv(), init_tun(), and undo_ifconfig_ipv4().
|
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().
void open_tun | ( | const char * | dev, |
const char * | dev_type, | ||
const char * | dev_node, | ||
struct tuntap * | tt, | ||
openvpn_net_ctx_t * | ctx | ||
) |
Definition at line 6815 of file tun.c.
References DEV_TYPE_NULL, DEV_TYPE_TAP, DEV_TYPE_TUN, tuntap_options::dhcp_options, DHCP_OPTIONS_DHCP_REQUIRED, gc_free(), gc_new(), M_FATAL, M_INFO, M_NOPREFIX, M_WARN, msg, open_null(), tuntap::options, print_windows_driver(), tun_open_device(), tuntap_is_dco_win(), tuntap_post_open(), tuntap::type, tuntap::windows_driver, and WINDOWS_DRIVER_TAP_WINDOWS6.
Referenced by do_open_tun().
const char* print_windows_driver | ( | enum windows_driver_type | windows_driver | ) |
Definition at line 7145 of file tun.c.
References WINDOWS_DRIVER_DCO, WINDOWS_DRIVER_TAP_WINDOWS6, and WINDOWS_DRIVER_WINTUN.
Referenced by close_tun_handle(), get_tap_reg(), open_tun(), options_postprocess_verify_ce(), show_tap_win_adapters(), tun_open_device(), and tun_try_open_device().
int read_tun | ( | struct tuntap * | tt, |
uint8_t * | buf, | ||
int | len | ||
) |
Referenced by read_incoming_tun().
Definition at line 514 of file tun.h.
References overlapped_io::buf_init, buf_write(), tun_ring::data, TUN_PACKET::data, tun_ring::head, buffer::len, M_INFO, msg, tuntap::reads, TUN_PACKET::size, tun_ring::tail, WINTUN_MAX_PACKET_SIZE, WINTUN_RING_CAPACITY, wintun_ring_packet_align(), wintun_ring_wrap(), and tuntap::wintun_send_ring.
Referenced by read_incoming_tun().
|
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().
void show_adapters | ( | int | msglev | ) |
Definition at line 5095 of file tun.c.
References gc_free(), gc_new(), get_adapter_info_list(), msg, and show_adapter().
Referenced by add_option(), check_add_routes(), do_route(), initialization_sequence_completed(), and management_show_net_callback().
void show_tap_win_adapters | ( | int | msglev, |
int | warnlev | ||
) |
Definition at line 4240 of file tun.c.
References gc_free(), gc_new(), get_panel_reg(), get_tap_reg(), tap_reg::guid, panel_reg::guid, msg, panel_reg::name, tap_reg::next, panel_reg::next, print_windows_driver(), and tap_reg::windows_driver.
Referenced by add_option().
void show_valid_win32_tun_subnets | ( | void | ) |
Definition at line 4207 of file tun.c.
Referenced by add_option().
void tap_allow_nonadmin_access | ( | const char * | dev_node | ) |
Definition at line 5144 of file tun.c.
References at_least_one_tap_win(), gc_free(), gc_new(), get_device_guid(), get_panel_reg(), get_tap_reg(), get_unspecified_device_guid(), M_ERR, M_FATAL, M_WARN, msg, and tap_allow_nonadmin_access_handle().
Referenced by add_option().
Definition at line 6859 of file tun.c.
References alloc_buf_gc(), BCAP, BSTR, tuntap::hand, buffer::len, tuntap::windows_driver, and WINDOWS_DRIVER_TAP_WINDOWS6.
Referenced by print_status(), and x_check_status().
bool tun_name_is_fixed | ( | const char * | dev | ) |
Definition at line 1881 of file tun.c.
References has_digit().
void tun_open_device | ( | struct tuntap * | tt, |
const char * | dev_node, | ||
const char ** | device_guid, | ||
struct gc_arena * | gc | ||
) |
Definition at line 6648 of file tun.c.
References tuntap::actual_name, tuntap::adapter_index, at_least_one_tap_win(), get_adapter_index(), get_device_guid(), get_device_instance_id_interface(), get_panel_reg(), get_tap_reg(), get_unspecified_device_guid(), M_FATAL, M_INFO, msg, device_instance_id_interface::next, print_windows_driver(), string_alloc(), tun_try_open_device(), tuntap::windows_driver, and WINDOWS_DRIVER_UNSPECIFIED.
Referenced by create_dco_handle(), and open_tun().
int tun_read_queue | ( | struct tuntap * | tt, |
int | maxsize | ||
) |
Definition at line 3625 of file tun.c.
References ASSERT, BLEN, BPTR, overlapped_io::buf, overlapped_io::buf_init, D_WIN32_IO, dmsg, gc_free(), gc_new(), tuntap::hand, overlapped_io::iostate, IOSTATE_IMMEDIATE_RETURN, IOSTATE_INITIAL, IOSTATE_QUEUED, overlapped_io::overlapped, tuntap::reads, overlapped_io::size, status, overlapped_io::status, and strerror_win32().
Referenced by tun_set().
|
inlinestatic |
Definition at line 725 of file tun.h.
References es, event_ctl(), EVENT_READ, tuntap::rwflags_debug, tun_event_handle(), tun_read_queue(), tuntap_defined(), tuntap_is_dco_win(), tuntap::windows_driver, and WINDOWS_DRIVER_TAP_WINDOWS6.
Referenced by io_wait_dowork(), and multi_tcp_wait().
void tun_show_debug | ( | struct tuntap * | tt | ) |
Definition at line 6877 of file tun.c.
References alloc_buf(), BCAP, BSTR, D_TAP_WIN_DEBUG, free_buf(), tuntap::hand, buffer::len, msg, tuntap::windows_driver, and WINDOWS_DRIVER_TAP_WINDOWS6.
Referenced by pre_select().
bool tun_standby | ( | struct tuntap * | tt | ) |
Definition at line 5823 of file tun.c.
References tuntap::adapter_index, tuntap::adapter_netmask, tuntap_options::ip_win32_type, IPW32_SET_ADAPTIVE, IPW32_SET_ADAPTIVE_TRY_NETSH, tuntap::local, M_INFO, msg, netsh_ifconfig(), NI_IP_NETMASK, NI_OPTIONS, NI_TEST_FIRST, tuntap::options, and tuntap::standby_iter.
Referenced by check_add_routes().
void tun_standby_init | ( | struct tuntap * | tt | ) |
Definition at line 703 of file tun.c.
References alloc_buf_gc(), BSTR, buf_printf(), EVENT_READ, EVENT_WRITE, overlapped_io_state_ascii(), tuntap::reads, tuntap::rwflags_debug, and tuntap::writes.
Definition at line 3689 of file tun.c.
References ASSERT, BLEN, BPTR, overlapped_io::buf, buf_copy(), overlapped_io::buf_init, D_WIN32_IO, dmsg, gc_free(), gc_new(), tuntap::hand, overlapped_io::iostate, IOSTATE_IMMEDIATE_RETURN, IOSTATE_INITIAL, IOSTATE_QUEUED, buffer::len, overlapped_io::overlapped, overlapped_io::size, status, overlapped_io::status, strerror_win32(), and tuntap::writes.
Referenced by tun_write_win32().
Definition at line 3752 of file tun.c.
References BLEN, tuntap::hand, sockethandle_t::is_handle, overlapped_io_active(), sockethandle_finalize(), status, tun_write_queue(), and tuntap::writes.
Referenced by write_tun_buffered().
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().
|
inlinestatic |
|
inlinestatic |
Definition at line 238 of file tun.h.
References tuntap::hand.
Referenced by dco_get_peer_stats(), pre_select(), print_status(), process_incoming_link_part2(), tun_set(), and x_check_status().
|
inlinestatic |
Definition at line 656 of file tun.h.
References tuntap::windows_driver, and WINDOWS_DRIVER_DCO.
Referenced by do_close_link_socket(), do_close_tun(), do_up(), open_tun(), tun_set(), and tuntap_is_dco_win_timeout().
|
inlinestatic |
Definition at line 662 of file tun.h.
References openvpn_errno, status, and tuntap_is_dco_win().
Referenced by read_incoming_link().
|
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().
|
inlinestatic |
Definition at line 255 of file tun.h.
References tun_ring::head, tun_ring::tail, tuntap_is_wintun(), and tuntap::wintun_send_ring.
Referenced by multi_tcp_wait(), p2mp_iow_flags(), and p2p_iow_flags().
|
inlinestatic |
void undo_ifconfig | ( | struct tuntap * | tt, |
openvpn_net_ctx_t * | ctx | ||
) |
undo_ifconfig - undo configuration of the tunnel interface
tt | the tuntap interface context |
ctx | the 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().
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().
void warn_on_use_of_common_subnets | ( | openvpn_net_ctx_t * | ctx | ) |
Definition at line 642 of file tun.c.
References route_gateway_address::addr, route_gateway_info::flags, route_gateway_info::gateway, gc_free(), gc_new(), get_default_gateway(), M_WARN, msg, route_gateway_address::netmask, RGI_ADDR_DEFINED, and RGI_NETMASK_DEFINED.
Referenced by do_option_warnings().
|
inlinestatic |
Definition at line 502 of file tun.h.
References WINTUN_PACKET_ALIGN.
Referenced by read_wintun(), and write_wintun().
|
inlinestatic |
Definition at line 508 of file tun.h.
References WINTUN_RING_CAPACITY.
Referenced by read_wintun(), and write_wintun().
int write_tun | ( | struct tuntap * | tt, |
uint8_t * | buf, | ||
int | len | ||
) |
Referenced by process_outgoing_tun().
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().
Definition at line 597 of file tun.h.
References tun_ring::alertable, BLEN, BPTR, D_LOW, tun_ring::data, TUN_PACKET::data, tun_ring::head, is_ip_packet_valid(), M_INFO, msg, tuntap::rw_handle, TUN_PACKET::size, tun_ring::tail, WINTUN_PACKET_ALIGN, tuntap::wintun_receive_ring, WINTUN_RING_CAPACITY, wintun_ring_packet_align(), wintun_ring_wrap(), and rw_handle::write.
Referenced by write_tun_buffered().