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 | 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 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 | |
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) |
#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) |
typedef struct afunix_context afunix_context_t |
enum tun_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 4745 of file tun.c.
References D_ROUTE_DEBUG, dmsg, gc, 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 test_route().
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().
void close_tun | ( | struct tuntap * | tt, |
openvpn_net_ctx_t * | ctx | ||
) |
Definition at line 6906 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, 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 6865 of file tun.c.
References tuntap::backend_driver, D_WIN32_IO_LOW, dmsg, tuntap::hand, M_ERRNO, M_WARN, msg, overlapped_io_close(), print_tun_backend_driver(), rw_handle::read, tuntap::reads, tuntap::rw_handle, 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 467 of file tun.c.
References 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 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().
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().
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().
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 |
tun_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 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().
Definition at line 750 of file tun.c.
References tuntap::did_ifconfig_ipv6_setup, tuntap::did_ifconfig_setup, es, gc, 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 6047 of file tun.c.
References alloc_buf_gc(), BSTR, buf_printf(), fork_to_self(), gc, gc_free(), gc_new(), buffer::len, 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 4550 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 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().
const IP_ADAPTER_INFO * get_adapter_info_list | ( | struct gc_arena * | gc | ) |
Definition at line 4436 of file tun.c.
References gc, 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 4463 of file tun.c.
References gc, 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 4654 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 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().
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().
|
inlinestatic |
Definition at line 376 of file tun.h.
References tuntap::backend_driver, DRIVER_AFUNIX, 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 794 of file tun.c.
References tuntap::adapter_netmask, ALLOC_OBJ, check_addr_clash(), clear_tuntap(), dev_type_enum(), 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(), is_tun_p2p(), tuntap::local, tuntap::local_ipv6, M_FATAL, msg, tuntap::netbits_ipv6, tuntap::remote_ipv6, tuntap::remote_netmask, 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 940 of file tun.c.
References tuntap::adapter_index, tuntap::backend_driver, tuntap::dco, DRIVER_DCO, M_FATAL, msg, tuntap::options, overlapped_io::overlapped, overlapped_io_init(), rw_handle::read, tuntap::reads, tuntap::rw_handle, TUN_ADAPTER_INDEX_INVALID, 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 5269 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 7024 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 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().
bool is_adapter_up | ( | const struct tuntap * | tt, |
const IP_ADAPTER_INFO * | list | ||
) |
Definition at line 4667 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 | ||
) |
Definition at line 449 of file tun.c.
References ASSERT.
Referenced by dev_type_enum(), and do_init_tun().
bool is_ip_in_adapter_subnet | ( | const IP_ADAPTER_INFO * | ai, |
const in_addr_t | ip, | ||
in_addr_t * | highest_netmask | ||
) |
Definition at line 4712 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 596 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 726 of file tun.c.
References DEV_TYPE_TAP, DEV_TYPE_TUN, buffer::len, M_FATAL, msg, and TOP_SUBNET.
Referenced by do_ifconfig_ipv4(), do_ifconfig_setenv(), ifconfig_options_string(), init_tun(), and undo_ifconfig_ipv4().
|
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().
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 6731 of file tun.c.
References tuntap::backend_driver, DEV_TYPE_TAP, DEV_TYPE_TUN, tuntap_options::dhcp_options, DHCP_OPTIONS_DHCP_REQUIRED, gc, gc_free(), gc_new(), M_FATAL, M_INFO, M_NOPREFIX, M_WARN, msg, tuntap::options, print_tun_backend_driver(), tun_open_device(), tuntap_is_dco_win(), tuntap_post_open(), tuntap::type, and WINDOWS_DRIVER_TAP_WINDOWS6.
Referenced by open_tun_backend().
|
inlinestatic |
Definition at line 788 of file tun.h.
References tuntap::actual_name, and string_alloc().
Referenced by open_tun_backend().
const char * print_tun_backend_driver | ( | enum tun_driver_type | driver | ) |
Return a string representation of the tun backed driver type.
Definition at line 59 of file tun.c.
References DRIVER_AFUNIX, DRIVER_DCO, DRIVER_GENERIC_TUNTAP, DRIVER_NULL, DRIVER_UTUN, WINDOWS_DRIVER_TAP_WINDOWS6, and WINDOWS_DRIVER_WINTUN.
Referenced by close_tun_handle(), do_close_tun_simple(), get_tap_reg(), open_tun(), open_tun_backend(), 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 540 of file tun.h.
References overlapped_io::buf_init, buf_write(), TUN_PACKET::data, tun_ring::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 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().
void show_adapters | ( | int | msglev | ) |
Definition at line 5012 of file tun.c.
References gc, 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 4157 of file tun.c.
References gc, 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_tun_backend_driver(), and tap_reg::windows_driver.
Referenced by add_option().
void show_valid_win32_tun_subnets | ( | void | ) |
Definition at line 4124 of file tun.c.
Referenced by add_option().
void tap_allow_nonadmin_access | ( | const char * | dev_node | ) |
Definition at line 5061 of file tun.c.
References at_least_one_tap_win(), gc, 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 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().
bool tun_name_is_fixed | ( | const char * | dev | ) |
Definition at line 1830 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 6565 of file tun.c.
References tuntap::actual_name, tuntap::adapter_index, at_least_one_tap_win(), tuntap::backend_driver, gc, get_adapter_index(), get_device_guid(), get_device_instance_id_interface(), get_panel_reg(), get_tap_reg(), get_unspecified_device_guid(), M_FATAL, msg, device_instance_id_interface::next, print_tun_backend_driver(), string_alloc(), tun_try_open_device(), and WINDOWS_DRIVER_UNSPECIFIED.
Referenced by create_socket_dco_win(), open_tun(), and ovpn_dco_init_mp().
int tun_read_queue | ( | struct tuntap * | tt, |
int | maxsize | ||
) |
Definition at line 3542 of file tun.c.
References ASSERT, BLEN, BPTR, overlapped_io::buf, overlapped_io::buf_init, D_WIN32_IO, dmsg, gc, gc_free(), gc_new(), tuntap::hand, overlapped_io::iostate, IOSTATE_IMMEDIATE_RETURN, IOSTATE_INITIAL, IOSTATE_QUEUED, overlapped_io::overlapped, tuntap::reads, overlapped_io::size, overlapped_io::status, status, and strerror_win32().
Referenced by tun_set().
|
inlinestatic |
Definition at line 748 of file tun.h.
References tuntap::backend_driver, es, event_ctl(), EVENT_READ, tuntap::rwflags_debug, tun_event_handle(), tun_read_queue(), tuntap_defined(), tuntap_is_dco_win(), and WINDOWS_DRIVER_TAP_WINDOWS6.
Referenced by multi_io_process_flags(), and multi_io_wait().
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().
bool tun_standby | ( | struct tuntap * | tt | ) |
Definition at line 5740 of file tun.c.
References IPW32_SET_ADAPTIVE, IPW32_SET_ADAPTIVE_TRY_NETSH, buffer::len, M_INFO, msg, netsh_ifconfig(), NI_IP_NETMASK, NI_OPTIONS, and NI_TEST_FIRST.
Referenced by check_add_routes().
void tun_standby_init | ( | struct tuntap * | tt | ) |
Definition at line 691 of file tun.c.
References alloc_buf_gc(), BSTR, buf_printf(), EVENT_READ, EVENT_WRITE, gc, buffer::len, and overlapped_io_state_ascii().
Definition at line 3606 of file tun.c.
References ASSERT, BLEN, BPTR, overlapped_io::buf, buf_copy(), overlapped_io::buf_init, D_WIN32_IO, dmsg, gc, gc_free(), gc_new(), tuntap::hand, overlapped_io::iostate, IOSTATE_IMMEDIATE_RETURN, IOSTATE_INITIAL, IOSTATE_QUEUED, buffer::len, overlapped_io::overlapped, overlapped_io::size, overlapped_io::status, status, strerror_win32(), and tuntap::writes.
Referenced by tun_write_win32().
Definition at line 3669 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 254 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 682 of file tun.h.
References tuntap::backend_driver, and 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 688 of file tun.h.
References openvpn_errno, status, and tuntap_is_dco_win().
Referenced by read_incoming_link().
|
inlinestatic |
Definition at line 265 of file tun.h.
References tuntap::backend_driver, and WINDOWS_DRIVER_WINTUN.
Referenced by get_io_flags_udp(), io_wait(), multi_io_process_flags(), multi_io_wait(), and tuntap_ring_empty().
|
inlinestatic |
Definition at line 271 of file tun.h.
References tun_ring::head, tun_ring::tail, tuntap_is_wintun(), and tuntap::wintun_send_ring.
Referenced by multi_io_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 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().
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().
void warn_on_use_of_common_subnets | ( | openvpn_net_ctx_t * | ctx | ) |
Definition at line 630 of file tun.c.
References route_gateway_address::addr, route_gateway_info::flags, route_gateway_info::gateway, gc, 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 528 of file tun.h.
References WINTUN_PACKET_ALIGN.
Referenced by read_wintun(), and write_wintun().
|
inlinestatic |
Definition at line 534 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 669 of file tun.h.
References tuntap::backend_driver, tun_write_win32(), WINDOWS_DRIVER_WINTUN, and write_wintun().
Referenced by process_outgoing_tun().
Definition at line 623 of file tun.h.
References tun_ring::alertable, BLEN, BPTR, D_LOW, TUN_PACKET::data, tun_ring::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().