OpenVPN
|
#include "syshead.h"
#include "tun.h"
#include "fdmisc.h"
#include "common.h"
#include "run_command.h"
#include "socket.h"
#include "manage.h"
#include "route.h"
#include "win32.h"
#include "block_dns.h"
#include "networking.h"
#include "memdbg.h"
#include "openvpn-msg.h"
#include <string.h>
Go to the source code of this file.
Data Structures | |
struct | ipset_names |
Macros | |
#define | NI_TEST_FIRST (1<<0) |
#define | NI_IP_NETMASK (1<<1) |
#define | NI_OPTIONS (1<<2) |
#define | DHCP_STATUS_UNDEF 0 |
#define | DHCP_STATUS_ENABLED 1 |
#define | DHCP_STATUS_DISABLED 2 |
Functions | |
static void | netsh_ifconfig (const struct tuntap_options *to, DWORD adapter_index, const in_addr_t ip, const in_addr_t netmask, const unsigned int flags) |
static void | windows_set_mtu (const int iface_index, const short family, const int mtu) |
static void | netsh_set_dns6_servers (const struct in6_addr *addr_list, const int addr_len, DWORD adapter_index) |
Set the ipv6 dns servers on the specified interface. More... | |
static void | netsh_command (const struct argv *a, int n, int msglevel) |
static const char * | netsh_get_id (const char *dev_node, struct gc_arena *gc) |
static bool | do_address_service (const bool add, const short family, const struct tuntap *tt) |
static bool | do_dns_domain_service (bool add, const struct tuntap *tt) |
static bool | do_dns_service (bool add, const short family, const struct tuntap *tt) |
static bool | do_set_mtu_service (const struct tuntap *tt, const short family, const int mtu) |
static void | clear_tuntap (struct tuntap *tuntap) |
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 * | guess_tuntap_dev (const char *dev, const char *dev_type, const char *dev_node, struct gc_arena *gc) |
static void | ifconfig_sanity_check (bool tun, in_addr_t addr, int topology) |
static void | check_addr_clash (const char *name, int type, in_addr_t public, in_addr_t local, in_addr_t remote_netmask) |
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) |
const char * | ifconfig_options_string (const struct tuntap *tt, bool remote, bool disable, struct gc_arena *gc) |
const char * | tun_stat (const struct tuntap *tt, unsigned int rwflags, struct gc_arena *gc) |
bool | is_tun_p2p (const struct tuntap *tt) |
void | do_ifconfig_setenv (const struct tuntap *tt, struct env_set *es) |
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) |
void | init_tun_post (struct tuntap *tt, const struct frame *frame, const struct tuntap_options *options) |
static void | add_route_connected_v6_net (struct tuntap *tt, const struct env_set *es) |
void | delete_route_connected_v6_net (const struct tuntap *tt) |
static void | do_ifconfig_ipv6 (struct tuntap *tt, const char *ifname, int tun_mtu, const struct env_set *es, openvpn_net_ctx_t *ctx) |
do_ifconfig_ipv6 - perform platform specific ifconfig6 commands More... | |
static void | do_ifconfig_ipv4 (struct tuntap *tt, const char *ifname, int tun_mtu, const struct env_set *es, openvpn_net_ctx_t *ctx) |
do_ifconfig_ipv4 - perform platform specific ifconfig commands More... | |
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... | |
static void | open_null (struct tuntap *tt) |
static const char * | print_windows_driver (enum windows_driver_type windows_driver) |
int | tun_read_queue (struct tuntap *tt, int maxsize) |
int | tun_write_queue (struct tuntap *tt, struct buffer *buf) |
int | tun_finalize (HANDLE h, struct overlapped_io *io, struct buffer *buf) |
static const struct device_instance_id_interface * | get_device_instance_id_interface (struct gc_arena *gc) |
static const struct tap_reg * | get_tap_reg (struct gc_arena *gc) |
static const struct panel_reg * | get_panel_reg (struct gc_arena *gc) |
void | verify_255_255_255_252 (in_addr_t local, in_addr_t remote) |
void | show_valid_win32_tun_subnets (void) |
void | show_tap_win_adapters (int msglev, int warnlev) |
static const struct tap_reg * | get_adapter_by_guid (const char *guid, const struct tap_reg *tap_reg) |
static const char * | guid_to_name (const char *guid, const struct panel_reg *panel_reg) |
static const struct tap_reg * | get_adapter_by_name (const char *name, const struct tap_reg *tap_reg, const struct panel_reg *panel_reg) |
static void | at_least_one_tap_win (const struct tap_reg *tap_reg) |
static const char * | get_unspecified_device_guid (const int device_number, uint8_t *actual_name, int actual_name_size, const struct tap_reg *tap_reg_src, const struct panel_reg *panel_reg_src, enum windows_driver_type *windows_driver, struct gc_arena *gc) |
static const char * | get_device_guid (const char *name, uint8_t *actual_name, int actual_name_size, enum windows_driver_type *windows_driver, const struct tap_reg *tap_reg, const struct panel_reg *panel_reg, struct gc_arena *gc) |
const IP_ADAPTER_INFO * | get_adapter_info_list (struct gc_arena *gc) |
const IP_PER_ADAPTER_INFO * | get_per_adapter_info (const DWORD index, struct gc_arena *gc) |
static const IP_INTERFACE_INFO * | get_interface_info_list (struct gc_arena *gc) |
static const IP_ADAPTER_INDEX_MAP * | get_interface_info (DWORD index, struct gc_arena *gc) |
const IP_ADAPTER_INFO * | get_adapter (const IP_ADAPTER_INFO *ai, DWORD index) |
const IP_ADAPTER_INFO * | get_adapter_info (DWORD index, struct gc_arena *gc) |
static int | get_adapter_n_ip_netmask (const IP_ADAPTER_INFO *ai) |
static bool | get_adapter_ip_netmask (const IP_ADAPTER_INFO *ai, const int n, in_addr_t *ip, in_addr_t *netmask) |
static bool | test_adapter_ip_netmask (const IP_ADAPTER_INFO *ai, const in_addr_t ip, const in_addr_t netmask) |
const IP_ADAPTER_INFO * | get_tun_adapter (const struct tuntap *tt, const IP_ADAPTER_INFO *list) |
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) |
static int | dhcp_status (DWORD index) |
static void | delete_temp_addresses (DWORD index) |
static DWORD | get_adapter_index_method_1 (const char *guid) |
static DWORD | get_adapter_index_method_2 (const char *guid) |
static DWORD | get_adapter_index (const char *guid) |
static const char * | format_ip_addr_string (const IP_ADDR_STRING *ip, struct gc_arena *gc) |
static void | show_adapter (int msglev, const IP_ADAPTER_INFO *a, struct gc_arena *gc) |
void | show_adapters (int msglev) |
static void | tap_allow_nonadmin_access_handle (const char *device_path, HANDLE hand) |
void | tap_allow_nonadmin_access (const char *dev_node) |
bool | dhcp_release_by_adapter_index (const DWORD adapter_index) |
static bool | dhcp_release (const struct tuntap *tt) |
bool | dhcp_renew_by_adapter_index (const DWORD adapter_index) |
static bool | dhcp_renew (const struct tuntap *tt) |
void | ipconfig_register_dns (const struct env_set *es) |
void | ip_addr_string_to_array (in_addr_t *dest, int *dest_len, const IP_ADDR_STRING *src) |
static bool | ip_addr_one_to_one (const in_addr_t *a1, const int a1len, const IP_ADDR_STRING *ias) |
static bool | ip_addr_member_of (const in_addr_t addr, const IP_ADDR_STRING *ias) |
static void | netsh_ifconfig_options (const char *type, const in_addr_t *addr_list, const int addr_len, const IP_ADDR_STRING *current, DWORD adapter_index, const bool test_first) |
static void | init_ip_addr_string2 (IP_ADDR_STRING *dest, const IP_ADDR_STRING *src1, const IP_ADDR_STRING *src2) |
static void | netsh_enable_dhcp (DWORD adapter_index) |
static bool | service_enable_dhcp (const struct tuntap *tt) |
void | tun_standby_init (struct tuntap *tt) |
bool | tun_standby (struct tuntap *tt) |
static void | write_dhcp_u8 (struct buffer *buf, const int type, const int data, bool *error) |
static void | write_dhcp_u32_array (struct buffer *buf, const int type, const uint32_t *data, const unsigned int len, bool *error) |
static void | write_dhcp_str (struct buffer *buf, const int type, const char *str, bool *error) |
static void | write_dhcp_search_str (struct buffer *buf, const int type, const char *const *str_array, int array_len, bool *error) |
static bool | build_dhcp_options_string (struct buffer *buf, const struct tuntap_options *o) |
static void | fork_dhcp_action (struct tuntap *tt) |
static void | register_dns_service (const struct tuntap *tt) |
static bool | service_register_ring_buffers (const struct tuntap *tt) |
void | fork_register_dns_action (struct tuntap *tt) |
static uint32_t | dhcp_masq_addr (const in_addr_t local, const in_addr_t netmask, const int offset) |
static void | tuntap_get_version_info (const struct tuntap *tt) |
static void | tuntap_get_mtu (struct tuntap *tt) |
static void | tuntap_set_ip_addr (struct tuntap *tt, const char *device_guid, bool dhcp_masq_post) |
static bool | wintun_register_ring_buffer (struct tuntap *tt, const char *device_guid) |
static void | tuntap_set_connected (const struct tuntap *tt) |
static void | tuntap_set_ptp (const struct tuntap *tt) |
static void | tuntap_dhcp_mask (const struct tuntap *tt, const char *device_guid) |
static bool | tun_try_open_device (struct tuntap *tt, const char *device_guid, const struct device_instance_id_interface *device_instance_id_interface) |
static void | tun_open_device (struct tuntap *tt, const char *dev_node, const char **device_guid, struct gc_arena *gc) |
static void | tuntap_set_ip_props (const struct tuntap *tt, bool *dhcp_masq, bool *dhcp_masq_post) |
static void | tuntap_post_open (struct tuntap *tt, const char *device_guid) |
void | open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tuntap *tt) |
const char * | tap_win_getinfo (const struct tuntap *tt, struct gc_arena *gc) |
void | tun_show_debug (struct tuntap *tt) |
static void | netsh_delete_address_dns (const struct tuntap *tt, bool ipv6, struct gc_arena *gc) |
void | close_tun (struct tuntap *tt, openvpn_net_ctx_t *ctx) |
int | ascii2ipset (const char *name) |
const char * | ipset2ascii (int index) |
const char * | ipset2ascii_all (struct gc_arena *gc) |
Variables | |
static const GUID | GUID_DEVCLASS_NET = { 0x4d36e972L, 0xe325, 0x11ce, { 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 } } |
static const GUID | GUID_DEVINTERFACE_NET = { 0xcac88484, 0x7515, 0x4c03, { 0x82, 0xe6, 0x71, 0xa8, 0x7a, 0xba, 0xc3, 0x61 } } |
static const char | ifconfig_warn_how_to_silence [] = "(silence this warning with --ifconfig-nowarn)" |
static const struct ipset_names | ipset_names [] |
#define DHCP_STATUS_DISABLED 2 |
Definition at line 4758 of file tun.c.
Referenced by dhcp_status(), tuntap_set_ip_addr(), and tuntap_set_ip_props().
#define DHCP_STATUS_ENABLED 1 |
Definition at line 4757 of file tun.c.
Referenced by dhcp_status(), and tuntap_set_ip_props().
#define DHCP_STATUS_UNDEF 0 |
Definition at line 4756 of file tun.c.
Referenced by dhcp_status().
#define NI_IP_NETMASK (1<<1) |
Definition at line 67 of file tun.c.
Referenced by do_ifconfig_ipv4(), netsh_ifconfig(), tun_standby(), and tuntap_set_ip_props().
#define NI_OPTIONS (1<<2) |
Definition at line 68 of file tun.c.
Referenced by do_ifconfig_ipv4(), netsh_ifconfig(), tun_standby(), and tuntap_set_ip_props().
#define NI_TEST_FIRST (1<<0) |
Definition at line 66 of file tun.c.
Referenced by netsh_ifconfig(), tun_standby(), and tuntap_set_ip_props().
DWORD adapter_index_of_ip | ( | const IP_ADAPTER_INFO * | list, |
const in_addr_t | ip, | ||
int * | count, | ||
in_addr_t * | netmask | ||
) |
Definition at line 4677 of file tun.c.
References D_ROUTE_DEBUG, dmsg, gc_free(), gc_new(), get_interface_metric(), in_addr_t, is_ip_in_adapter_subnet(), print_in_addr_t(), and TUN_ADAPTER_INDEX_INVALID.
Referenced by get_default_gateway(), and test_route().
Definition at line 941 of file tun.c.
References add_route_ipv6(), CLEAR, route_ipv6::flags, route_ipv6::gateway, tuntap::local_ipv6, route_ipv6::metric, route_ipv6::netbits, tuntap::netbits_ipv6, route_ipv6::network, RT_DEFINED, and RT_METRIC_DEFINED.
Referenced by do_ifconfig_ipv6().
int ascii2ipset | ( | const char * | name | ) |
Definition at line 6908 of file tun.c.
References ASSERT, IPW32_SET_N, ipset_names::short_form, and SIZE.
Referenced by add_option().
|
static |
Definition at line 4220 of file tun.c.
Referenced by netsh_get_id(), tap_allow_nonadmin_access(), and tun_open_device().
|
static |
Definition at line 5832 of file tun.c.
References buf_safe(), buf_write_u32(), buf_write_u8(), tuntap_options::disable_nbt, tuntap_options::dns, tuntap_options::dns_len, tuntap_options::domain, tuntap_options::domain_search_list, tuntap_options::domain_search_list_len, M_WARN, msg, tuntap_options::nbdd, tuntap_options::nbdd_len, tuntap_options::netbios_node_type, tuntap_options::netbios_scope, tuntap_options::ntp, tuntap_options::ntp_len, tuntap_options::wins, tuntap_options::wins_len, write_dhcp_search_str(), write_dhcp_str(), write_dhcp_u32_array(), and write_dhcp_u8().
Referenced by tuntap_dhcp_mask().
|
static |
Definition at line 463 of file tun.c.
References DEV_TYPE_TAP, DEV_TYPE_TUN, gc_free(), gc_new(), ifconfig_warn_how_to_silence, in_addr_t, M_INFO, M_WARN, msg, and print_in_addr_t().
Referenced by init_tun().
Definition at line 536 of file tun.c.
References gc_free(), gc_new(), get_default_gateway(), in_addr_t, M_WARN, msg, and print_in_addr_t().
Referenced by add_routes(), init_tun(), and tuntap_ring_empty().
|
static |
Definition at line 1609 of file tun.c.
References CLEAR, and tuntap::hand.
Referenced by close_tun(), do_set_mtu_service(), init_tun(), and open_null().
void close_tun | ( | struct tuntap * | tt, |
openvpn_net_ctx_t * | ctx | ||
) |
Definition at line 6780 of file tun.c.
References tuntap::actual_name, ASSERT, clear_tuntap(), D_WIN32_IO_LOW, delete_route_connected_v6_net(), dhcp_release(), tuntap::did_ifconfig_ipv6_setup, tuntap::did_ifconfig_setup, dmsg, tuntap_options::dns6_len, do_address_service(), do_dns_domain_service(), do_dns_service(), free, gc_free(), gc_new(), tuntap::hand, 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_ERRNO, M_WARN, msg, tuntap_options::msg_channel, netsh_delete_address_dns(), tuntap::options, overlapped_io_close(), rw_handle::read, tuntap::reads, tuntap::rw_handle, status, strerror_win32(), 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 do_close_tun_simple(), ipset2ascii_all(), open_null(), and tuntap_ring_empty().
void delete_route_connected_v6_net | ( | const struct tuntap * | tt | ) |
Definition at line 956 of file tun.c.
References CLEAR, delete_route_ipv6(), route_ipv6::flags, route_ipv6::gateway, in_addr_t, tuntap::local, tuntap::local_ipv6, route_ipv6::metric, route_ipv6::netbits, tuntap::netbits_ipv6, route_ipv6::network, tuntap::remote_netmask, route_ipv6_clear_host_bits(), RT_ADDED, RT_DEFINED, and RT_METRIC_DEFINED.
Referenced by close_tun(), and netsh_delete_address_dns().
|
static |
Definition at line 4790 of file tun.c.
References gc_free(), gc_new(), get_adapter_info(), M_INFO, msg, and status.
Referenced by tuntap_set_ip_addr().
int dev_type_enum | ( | const char * | dev, |
const char * | dev_type | ||
) |
Definition at line 361 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(), guess_tuntap_dev(), helper_client_server(), init_tun(), multi_init(), open_null(), options_postprocess_mutate_ce(), options_postprocess_mutate_invariant(), options_postprocess_verify_ce(), and tuntap_ring_empty().
const char* dev_type_string | ( | const char * | dev, |
const char * | dev_type | ||
) |
Definition at line 382 of file tun.c.
References dev_type_enum(), DEV_TYPE_NULL, DEV_TYPE_TAP, and DEV_TYPE_TUN.
Referenced by do_open_tun(), open_null(), options_string(), and tuntap_ring_empty().
|
static |
Definition at line 5996 of file tun.c.
References gc_free(), gc_new(), in_addr_t, M_FATAL, msg, and print_in_addr_t().
Referenced by tuntap_dhcp_mask().
|
static |
Definition at line 5122 of file tun.c.
References tuntap::adapter_index, dhcp_release_by_adapter_index(), tuntap_options::ip_win32_type, IPW32_SET_DHCP_MASQ, tuntap::options, and TUN_ADAPTER_INDEX_INVALID.
Referenced by close_tun(), and tuntap_set_ip_addr().
bool dhcp_release_by_adapter_index | ( | const DWORD | adapter_index | ) |
Definition at line 5095 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().
|
static |
Definition at line 5161 of file tun.c.
References tuntap::adapter_index, dhcp_renew_by_adapter_index(), tuntap_options::ip_win32_type, IPW32_SET_DHCP_MASQ, tuntap::options, and TUN_ADAPTER_INDEX_INVALID.
Referenced by show_tuntap_options(), and tuntap_set_ip_addr().
bool dhcp_renew_by_adapter_index | ( | const DWORD | adapter_index | ) |
Definition at line 5135 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().
|
static |
Definition at line 4761 of file tun.c.
References DHCP_STATUS_DISABLED, DHCP_STATUS_ENABLED, DHCP_STATUS_UNDEF, gc_free(), gc_new(), get_adapter_info(), and TUN_ADAPTER_INDEX_INVALID.
Referenced by tuntap_set_ip_addr(), and tuntap_set_ip_props().
|
static |
Definition at line 89 of file tun.c.
References tuntap::actual_name, tuntap::adapter_index, tuntap::adapter_netmask, address_message_t::address, D_IFCONFIG, DEV_TYPE_TUN, ack_message_t::error_number, address_message_t::family, gc_free(), gc_new(), address_message_t::header, address_message_t::iface, interface_t::index, inet_address_t::ipv4, inet_address_t::ipv6, tuntap::local, tuntap::local_ipv6, M_WARN, msg, msg_add_address, tuntap_options::msg_channel, msg_del_address, interface_t::name, tuntap::netbits_ipv6, netmask_to_netbits2(), tuntap::options, address_message_t::prefix_len, print_in6_addr(), print_in_addr_t(), send_msg_iservice(), strerror_win32(), TUN_ADAPTER_INDEX_INVALID, and tuntap::type.
Referenced by close_tun(), do_ifconfig_ipv4(), and do_ifconfig_ipv6().
|
static |
Definition at line 150 of file tun.c.
References tuntap::actual_name, tuntap::adapter_index, D_LOW, tuntap_options::domain, dns_cfg_message_t::domains, ack_message_t::error_number, gc_free(), gc_new(), dns_cfg_message_t::header, dns_cfg_message_t::iface, interface_t::index, M_INFO, M_WARN, msg, msg_add_dns_cfg, tuntap_options::msg_channel, msg_del_dns_cfg, interface_t::name, tuntap::options, send_msg_iservice(), strerror_win32(), and strncpynt().
Referenced by close_tun(), do_ifconfig_ipv4(), and do_ifconfig_ipv6().
|
static |
Definition at line 205 of file tun.c.
References tuntap::actual_name, tuntap::adapter_index, dns_cfg_message_t::addr, dns_cfg_message_t::addr_len, D_LOW, tuntap_options::dns, tuntap_options::dns6, tuntap_options::dns6_len, tuntap_options::dns_len, ack_message_t::error_number, gc_free(), gc_new(), dns_cfg_message_t::header, dns_cfg_message_t::iface, interface_t::index, inet_address_t::ipv4, inet_address_t::ipv6, M_INFO, M_WARN, msg, msg_add_dns_cfg, tuntap_options::msg_channel, msg_del_dns_cfg, interface_t::name, tuntap::options, send_msg_iservice(), and strerror_win32().
Referenced by close_tun(), do_ifconfig_ipv4(), and do_ifconfig_ipv6().
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 1575 of file tun.c.
References D_LOW, tuntap::did_ifconfig_ipv6_setup, tuntap::did_ifconfig_setup, do_ifconfig_ipv4(), do_ifconfig_ipv6(), tuntap::local, tuntap::local_ipv6, management_set_state(), msg, net_ctx_free(), and OPENVPN_STATE_ASSIGN_IP.
Referenced by do_open_tun(), and tuntap_ring_empty().
|
static |
do_ifconfig_ipv4 - perform platform specific ifconfig commands
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 1206 of file tun.c.
References tuntap::adapter_index, tuntap::adapter_netmask, add_route(), argv_free(), argv_msg(), argv_new(), argv_printf(), CLEAR, DEV_TYPE_TUN, do_address_service(), do_dns_domain_service(), do_dns_service(), do_set_mtu_service(), env_set_add(), env_set_create(), env_set_destroy(), route_ipv4::flags, route_ipv4::gateway, gc_free(), gc_new(), IFCONFIG_PATH, in_addr_t, tuntap_options::ip_win32_type, IPW32_SET_ADAPTIVE, IPW32_SET_DHCP_MASQ, IPW32_SET_MANUAL, IPW32_SET_NETSH, is_tun_p2p(), tuntap::local, M_FATAL, M_INFO, route_ipv4::metric, msg, tuntap_options::msg_channel, route_ipv4::netmask, netmask_to_netbits2(), netsh_ifconfig(), route_ipv4::network, NI_IP_NETMASK, NI_OPTIONS, openvpn_execve_check(), openvpn_snprintf(), tuntap::options, print_in_addr_t(), tuntap::remote_netmask, RT_DEFINED, RT_METRIC_DEFINED, S_FATAL, TOP_NET30, TOP_P2P, TOP_SUBNET, tuntap::topology, tuntap::type, and windows_set_mtu().
Referenced by do_ifconfig().
|
static |
do_ifconfig_ipv6 - perform platform specific ifconfig6 commands
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 1008 of file tun.c.
References tuntap::adapter_index, add_route_connected_v6_net(), argv_free(), argv_msg(), argv_new(), argv_printf(), DEV_TYPE_TUN, tuntap::did_ifconfig_setup, tuntap_options::dns6, tuntap_options::dns6_len, do_address_service(), do_dns_domain_service(), do_dns_service(), do_set_mtu_service(), env_set_add(), env_set_create(), env_set_destroy(), gc_free(), gc_new(), get_win_sys_path(), IFCONFIG_PATH, tuntap_options::ip_win32_type, IPW32_SET_MANUAL, tuntap::local_ipv6, M_FATAL, M_INFO, msg, tuntap_options::msg_channel, tuntap::netbits_ipv6, netsh_command(), NETSH_PATH_SUFFIX, netsh_set_dns6_servers(), openvpn_execve_check(), openvpn_snprintf(), tuntap::options, print_in6_addr(), tuntap::remote_ipv6, S_FATAL, sleep, tuntap::type, and windows_set_mtu().
Referenced by do_ifconfig().
Definition at line 689 of file tun.c.
References tuntap::did_ifconfig_ipv6_setup, tuntap::did_ifconfig_setup, 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(), init_tun(), and tuntap_ring_empty().
|
static |
Definition at line 282 of file tun.c.
References tuntap::actual_name, tuntap::adapter_index, clear_tuntap(), ack_message_t::error_number, gc_free(), gc_new(), set_mtu_message_t::header, iface, set_mtu_message_t::iface, interface_t::index, M_INFO, M_NONFATAL, msg, tuntap_options::msg_channel, msg_set_mtu, interface_t::name, tuntap::options, send_msg_iservice(), strerror_win32(), and strncpynt().
Referenced by do_ifconfig_ipv4(), and do_ifconfig_ipv6().
|
static |
Definition at line 5882 of file tun.c.
References tuntap::adapter_index, alloc_buf_gc(), BSTR, buf_printf(), tuntap_options::dhcp_pre_release, tuntap_options::dhcp_renew, fork_to_self(), gc_free(), gc_new(), and tuntap::options.
Referenced by tuntap_set_ip_addr().
void fork_register_dns_action | ( | struct tuntap * | tt | ) |
Definition at line 5977 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().
|
static |
Definition at line 4890 of file tun.c.
References alloc_buf_gc(), BSTR, and buf_printf().
Referenced by show_adapter().
const IP_ADAPTER_INFO* get_adapter | ( | const IP_ADAPTER_INFO * | ai, |
DWORD | index | ||
) |
Definition at line 4482 of file tun.c.
References TUN_ADAPTER_INDEX_INVALID.
Referenced by get_adapter_info(), get_default_gateway(), get_tun_adapter(), and netsh_ifconfig().
|
static |
Definition at line 4172 of file tun.c.
References tap_reg::guid, and tap_reg::next.
Referenced by get_adapter_by_name(), and get_device_guid().
|
static |
Definition at line 4204 of file tun.c.
References get_adapter_by_guid(), panel_reg::guid, panel_reg::name, and panel_reg::next.
Referenced by get_device_guid().
|
static |
Definition at line 4871 of file tun.c.
References get_adapter_index_method_1(), get_adapter_index_method_2(), M_INFO, msg, and TUN_ADAPTER_INDEX_INVALID.
Referenced by tun_open_device().
|
static |
Definition at line 4831 of file tun.c.
References openvpn_swprintf(), SIZE, and TUN_ADAPTER_INDEX_INVALID.
Referenced by get_adapter_index().
|
static |
Definition at line 4849 of file tun.c.
References gc_free(), gc_new(), get_adapter_info_list(), gc_arena::list, and TUN_ADAPTER_INDEX_INVALID.
Referenced by get_adapter_index().
const IP_ADAPTER_INFO* get_adapter_info | ( | DWORD | index, |
struct gc_arena * | gc | ||
) |
Definition at line 4501 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 4368 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().
|
static |
Definition at line 4528 of file tun.c.
References getaddr(), and GETADDR_HOST_ORDER.
Referenced by is_adapter_up(), is_ip_in_adapter_subnet(), and test_adapter_ip_netmask().
|
static |
Definition at line 4507 of file tun.c.
Referenced by is_adapter_up(), and is_ip_in_adapter_subnet().
|
static |
Definition at line 4300 of file tun.c.
References alloc_buf_gc(), ASSERT, BSTR, buf_printf(), buf_set_write(), clear_buf(), get_adapter_by_guid(), get_adapter_by_name(), tap_reg::guid, guid_to_name(), and tap_reg::windows_driver.
Referenced by netsh_get_id(), tap_allow_nonadmin_access(), and tun_open_device().
|
static |
Definition at line 3648 of file tun.c.
References alloc_buf_gc(), ALLOC_OBJ_CLEAR_GC, BSTR, device_instance_id_interface::device_interface_list, GUID_DEVCLASS_NET, GUID_DEVINTERFACE_NET, M_FATAL, msg, device_instance_id_interface::net_cfg_instance_id, device_instance_id_interface::next, status, strerror_win32(), and string_alloc().
Referenced by tun_open_device().
|
static |
Definition at line 4458 of file tun.c.
References get_interface_info_list().
Referenced by dhcp_release_by_adapter_index(), and dhcp_renew_by_adapter_index().
|
static |
Definition at line 4428 of file tun.c.
References gc_malloc(), M_INFO, msg, status, and strerror_win32().
Referenced by get_interface_info().
Definition at line 3901 of file tun.c.
References ALLOC_OBJ_CLEAR_GC, D_REGISTRY, dmsg, gc_malloc(), panel_reg::guid, M_FATAL, msg, panel_reg::name, panel_reg::next, openvpn_snprintf(), status, and string_alloc().
Referenced by netsh_get_id(), show_tap_win_adapters(), tap_allow_nonadmin_access(), and tun_open_device().
const IP_PER_ADAPTER_INFO* get_per_adapter_info | ( | const DWORD | index, |
struct gc_arena * | gc | ||
) |
Definition at line 4395 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().
Definition at line 3764 of file tun.c.
References ALLOC_OBJ_CLEAR_GC, D_REGISTRY, dmsg, tap_reg::guid, M_FATAL, msg, tap_reg::next, openvpn_snprintf(), status, strcasecmp, string_alloc(), TAP_WIN_COMPONENT_ID, tap_reg::windows_driver, WINDOWS_DRIVER_TAP_WINDOWS6, WINDOWS_DRIVER_UNSPECIFIED, WINDOWS_DRIVER_WINTUN, and WINTUN_COMPONENT_ID.
Referenced by netsh_get_id(), show_tap_win_adapters(), tap_allow_nonadmin_access(), and tun_open_device().
const IP_ADAPTER_INFO* get_tun_adapter | ( | const struct tuntap * | tt, |
const IP_ADAPTER_INFO * | list | ||
) |
Definition at line 4586 of file tun.c.
References tuntap::adapter_index, and get_adapter().
Referenced by is_adapter_up(), and windows_route_find_if_index().
|
static |
Definition at line 4233 of file tun.c.
References alloc_buf_gc(), ASSERT, BSTR, buf_printf(), buf_set_write(), clear_buf(), tap_reg::guid, guid_to_name(), tap_reg::next, and tap_reg::windows_driver.
Referenced by netsh_get_id(), tap_allow_nonadmin_access(), and tun_open_device().
const char* guess_tuntap_dev | ( | const char * | dev, |
const char * | dev_type, | ||
const char * | dev_node, | ||
struct gc_arena * | gc | ||
) |
Definition at line 405 of file tun.c.
References dev_type_enum(), DEV_TYPE_TAP, DEV_TYPE_TUN, and netsh_get_id().
Referenced by do_open_tun(), and tuntap_ring_empty().
|
static |
Definition at line 4188 of file tun.c.
References panel_reg::guid, panel_reg::name, and panel_reg::next.
Referenced by get_device_guid(), and get_unspecified_device_guid().
const char* ifconfig_options_string | ( | const struct tuntap * | tt, |
bool | remote, | ||
bool | disable, | ||
struct gc_arena * | gc | ||
) |
Definition at line 590 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(), and tuntap_ring_empty().
|
static |
Definition at line 434 of file tun.c.
References gc_free(), gc_new(), ifconfig_warn_how_to_silence, M_WARN, msg, print_in_addr_t(), TOP_NET30, and TOP_P2P.
Referenced by init_tun().
|
static |
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 | ||
) |
Definition at line 733 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(), gc_free(), gc_new(), 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(), options_string(), and tuntap_ring_empty().
void init_tun_post | ( | struct tuntap * | tt, |
const struct frame * | frame, | ||
const struct tuntap_options * | options | ||
) |
Definition at line 888 of file tun.c.
References tuntap::adapter_index, 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_WINTUN, tuntap::wintun_receive_ring_handle, tuntap::wintun_send_ring_handle, rw_handle::write, and tuntap::writes.
Referenced by do_init_tun(), and tuntap_ring_empty().
|
static |
Definition at line 5293 of file tun.c.
References in_addr_t, ip_addr_string_to_array(), and SIZE.
Referenced by netsh_ifconfig_options().
|
static |
Definition at line 5269 of file tun.c.
References in_addr_t, ip_addr_string_to_array(), and SIZE.
Referenced by netsh_ifconfig_options().
void ip_addr_string_to_array | ( | in_addr_t * | dest, |
int * | dest_len, | ||
const IP_ADDR_STRING * | src | ||
) |
Definition at line 5225 of file tun.c.
References gc_free(), gc_new(), getaddr(), GETADDR_HOST_ORDER, in_addr_t, M_INFO, msg, and print_in_addr_t().
Referenced by ip_addr_member_of(), and ip_addr_one_to_one().
void ipconfig_register_dns | ( | const struct env_set * | es | ) |
Definition at line 5199 of file tun.c.
References argv_free(), argv_msg(), argv_new(), argv_printf(), D_TUNTAP_INFO, 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 6923 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 6937 of file tun.c.
References alloc_buf_gc(), ASSERT, BSTR, buf_printf(), close_tun(), free, ipset2ascii(), IPW32_SET_N, buffer::len, open_tun(), read, read_tun(), SIZE, write, and write_tun().
Referenced by add_option().
bool is_adapter_up | ( | const struct tuntap * | tt, |
const IP_ADAPTER_INFO * | list | ||
) |
Definition at line 4599 of file tun.c.
References tuntap::adapter_netmask, get_adapter_ip_netmask(), get_adapter_n_ip_netmask(), get_tun_adapter(), in_addr_t, 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 343 of file tun.c.
References ASSERT.
Referenced by dev_type_enum(), and tuntap_ring_empty().
bool is_ip_in_adapter_subnet | ( | const IP_ADAPTER_INFO * | ai, |
const in_addr_t | ip, | ||
in_addr_t * | highest_netmask | ||
) |
Definition at line 4644 of file tun.c.
References get_adapter_ip_netmask(), get_adapter_n_ip_netmask(), and in_addr_t.
Referenced by adapter_index_of_ip(), and windows_route_find_if_index().
bool is_tun_p2p | ( | const struct tuntap * | tt | ) |
Definition at line 663 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(), open_null(), and tuntap_ring_empty().
|
static |
Definition at line 5178 of file tun.c.
References argv_msg_prefix(), M_INFO, management_sleep(), msg, netcmd_semaphore_lock(), netcmd_semaphore_release(), openvpn_execve_check(), and status.
Referenced by do_ifconfig_ipv6(), netsh_delete_address_dns(), netsh_enable_dhcp(), netsh_ifconfig(), netsh_ifconfig_options(), and netsh_set_dns6_servers().
|
static |
Definition at line 6721 of file tun.c.
References tuntap::adapter_index, argv_free(), argv_new(), argv_printf(), delete_route_connected_v6_net(), DEV_TYPE_TUN, tuntap_options::dns6_len, tuntap_options::dns_len, get_win_sys_path(), tuntap::local, tuntap::local_ipv6, M_WARN, netsh_command(), NETSH_PATH_SUFFIX, tuntap::options, print_in6_addr(), print_in_addr_t(), tuntap::type, and tuntap_options::wins_len.
Referenced by close_tun().
|
static |
Definition at line 5525 of file tun.c.
References argv_free(), argv_new(), argv_printf(), get_win_sys_path(), M_FATAL, netsh_command(), and NETSH_PATH_SUFFIX.
Referenced by tuntap_set_ip_props().
|
static |
Definition at line 5623 of file tun.c.
References alloc_buf_gc(), at_least_one_tap_win(), BCAP, BPTR, BSTR, get_device_guid(), get_panel_reg(), get_tap_reg(), and get_unspecified_device_guid().
Referenced by guess_tuntap_dev().
|
static |
Definition at line 5453 of file tun.c.
References argv_free(), argv_new(), argv_printf(), BOOL_CAST, CLEAR, tuntap_options::dns, tuntap_options::dns_len, gc_free(), gc_new(), get_adapter(), get_adapter_info_list(), get_per_adapter_info(), get_win_sys_path(), init_ip_addr_string2(), M_FATAL, M_INFO, msg, netsh_command(), netsh_ifconfig_options(), NETSH_PATH_SUFFIX, NI_IP_NETMASK, NI_OPTIONS, NI_TEST_FIRST, print_in_addr_t(), test_adapter_ip_netmask(), tuntap_options::wins, and tuntap_options::wins_len.
Referenced by do_ifconfig_ipv4(), tun_standby(), and tuntap_set_ip_props().
|
static |
Definition at line 5354 of file tun.c.
References argv_free(), argv_new(), argv_printf(), argv_printf_cat(), gc_free(), gc_new(), get_win_sys_path(), ip_addr_member_of(), ip_addr_one_to_one(), M_FATAL, M_INFO, msg, netsh_command(), NETSH_PATH_SUFFIX, print_in_addr_t(), win32_version_info(), and WIN_7.
Referenced by netsh_ifconfig().
|
static |
Set the ipv6 dns servers on the specified interface.
The list of dns servers currently set on the interface are cleared first.
Definition at line 5316 of file tun.c.
References argv_free(), argv_new(), argv_printf(), argv_printf_cat(), gc_free(), gc_new(), get_win_sys_path(), M_FATAL, M_NONFATAL, netsh_command(), NETSH_PATH_SUFFIX, print_in6_addr(), win32_version_info(), and WIN_7.
Referenced by do_ifconfig_ipv6().
|
static |
Definition at line 1623 of file tun.c.
References tuntap::actual_name, alloc_buf_gc(), ALLOC_OBJ, argv_free(), argv_msg(), argv_new(), argv_printf(), ASSERT, BSTR, buf_printf(), check_malloc_return(), CLEAR, clear_tuntap(), close_tun(), management::connection, D_OSBUF, D_READ_WRITE, dev_type_enum(), DEV_TYPE_NULL, dev_type_string(), DEV_TYPE_TAP, DEV_TYPE_TUN, tuntap::did_ifconfig_ipv6_setup, tuntap::did_ifconfig_setup, tuntap_options::dns, tuntap_options::dns6, tuntap_options::dns6_len, tuntap_options::dns_len, tuntap_options::domain, env_set_add(), env_set_create(), env_set_destroy(), http-client::f, F_OK, free, gc_free(), gc_new(), has_digit(), IFCONFIG_PATH, is_tun_p2p(), buffer::len, tuntap::local, tuntap::local_ipv6, M_ERR, M_ERRNO, M_FATAL, M_INFO, M_WARN, malloc, management_sleep(), msg, net_ctx_reset(), tuntap::netbits_ipv6, netmask_to_netbits2(), open_tun(), openvpn_execve_check(), OPENVPN_IPH_GET_VER, openvpn_snprintf(), tuntap::options, tuntap::persistent_if, platform_group_get(), platform_user_get(), print_in6_addr(), print_in_addr_t(), read, read_tun(), tuntap::remote_netmask, ROUTE_PATH, S_FATAL, set_cloexec(), set_nonblock(), snprintf, string_alloc(), strncpynt(), tuncfg(), tuntap::type, openvpn_iphdr::version_len, write, and write_tun().
Referenced by open_tun().
void open_tun | ( | const char * | dev, |
const char * | dev_type, | ||
const char * | dev_node, | ||
struct tuntap * | tt | ||
) |
Definition at line 6656 of file tun.c.
References DEV_TYPE_NULL, DEV_TYPE_TAP, DEV_TYPE_TUN, gc_free(), gc_new(), M_FATAL, M_INFO, M_NOPREFIX, msg, open_null(), tun_open_device(), tuntap_post_open(), and tuntap::type.
Referenced by do_open_tun(), ipset2ascii_all(), open_null(), and tuntap_ring_empty().
|
static |
Definition at line 3421 of file tun.c.
References WINDOWS_DRIVER_TAP_WINDOWS6, and WINDOWS_DRIVER_WINTUN.
Referenced by show_tap_win_adapters(), tun_open_device(), and tun_try_open_device().
|
static |
Definition at line 5908 of file tun.c.
References ack_message_t::error_number, gc_free(), gc_new(), M_INFO, M_WARN, msg, tuntap_options::msg_channel, msg_register_dns, tuntap::options, send_msg_iservice(), and strerror_win32().
Referenced by fork_register_dns_action().
|
static |
Definition at line 5543 of file tun.c.
References tuntap::adapter_index, ack_message_t::error_number, gc_free(), gc_new(), iface, enable_dhcp_message_t::iface, interface_t::index, M_INFO, M_NONFATAL, msg, tuntap_options::msg_channel, msg_enable_dhcp, tuntap::options, send_msg_iservice(), and strerror_win32().
Referenced by tuntap_set_ip_props().
|
static |
Definition at line 5937 of file tun.c.
References ack_message_t::error_number, gc_free(), gc_new(), tuntap::hand, M_INFO, M_NONFATAL, msg, tuntap_options::msg_channel, msg_register_ring_buffers, tuntap::options, rw_handle::read, tuntap::rw_handle, send_msg_iservice(), strerror_win32(), tuntap::wintun_receive_ring_handle, tuntap::wintun_send_ring_handle, and rw_handle::write.
Referenced by wintun_register_ring_buffer().
|
static |
Definition at line 4911 of file tun.c.
References format_hex_ex(), format_ip_addr_string(), get_per_adapter_info(), msg, and time_string().
Referenced by show_adapters().
void show_adapters | ( | int | msglev | ) |
Definition at line 4944 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 4090 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 4057 of file tun.c.
Referenced by add_option().
void tap_allow_nonadmin_access | ( | const char * | dev_node | ) |
Definition at line 4993 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, openvpn_snprintf(), and tap_allow_nonadmin_access_handle().
Referenced by add_option().
|
static |
Definition at line 4971 of file tun.c.
References init_security_attributes_allow_all(), M_ERR, M_ERRNO, M_INFO, M_NOPREFIX, msg, security_attributes::sd, and status.
Referenced by tap_allow_nonadmin_access().
Definition at line 6685 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().
|
static |
Definition at line 4570 of file tun.c.
References get_adapter_ip_netmask(), in_addr_t, and status.
Referenced by netsh_ifconfig().
int tun_finalize | ( | HANDLE | h, |
struct overlapped_io * | io, | ||
struct buffer * | buf | ||
) |
Definition at line 3564 of file tun.c.
References ASSERT, overlapped_io::buf, D_WIN32_IO, dmsg, overlapped_io::iostate, IOSTATE_IMMEDIATE_RETURN, IOSTATE_INITIAL, IOSTATE_QUEUED, buffer::len, M_ERRNO, msg, overlapped_io::overlapped, overlapped_io::size, status, and overlapped_io::status.
Referenced by read_tun_buffered(), and tun_write_win32().
|
static |
Definition at line 6489 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 open_tun().
int tun_read_queue | ( | struct tuntap * | tt, |
int | maxsize | ||
) |
Definition at line 3437 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().
void tun_show_debug | ( | struct tuntap * | tt | ) |
Definition at line 6703 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 5670 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(), and write_tun_buffered().
void tun_standby_init | ( | struct tuntap * | tt | ) |
Definition at line 5664 of file tun.c.
References tuntap::standby_iter.
Referenced by do_up(), and write_tun_buffered().
Definition at line 628 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.
Referenced by tun_set().
|
static |
Definition at line 6427 of file tun.c.
References D_TUNTAP_INFO, device_instance_id_interface::device_interface_list, tuntap::hand, msg, device_instance_id_interface::net_cfg_instance_id, device_instance_id_interface::next, openvpn_snprintf(), print_windows_driver(), tuntap::windows_driver, WINDOWS_DRIVER_WINTUN, and wintun_register_ring_buffer().
Referenced by tun_open_device().
Definition at line 3501 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().
|
static |
Definition at line 6345 of file tun.c.
References tuntap::adapter_netmask, alloc_buf(), ASSERT, BLEN, BPTR, build_dhcp_options_string(), D_DHCP_OPT, DEV_TYPE_TAP, DEV_TYPE_TUN, tuntap_options::dhcp_lease_time, dhcp_masq_addr(), tuntap_options::dhcp_masq_custom_offset, tuntap_options::dhcp_masq_offset, tuntap_options::dhcp_options, format_hex(), free_buf(), gc_free(), gc_new(), tuntap::hand, IA_NET_ORDER, tuntap::local, M_FATAL, M_INFO, M_WARN, msg, tuntap::options, print_in_addr_t(), tuntap::remote_netmask, TOP_SUBNET, tuntap::topology, and tuntap::type.
Referenced by tuntap_post_open().
|
static |
Definition at line 6066 of file tun.c.
References D_MTU_INFO, tuntap::hand, msg, and tuntap::post_open_mtu.
Referenced by tuntap_post_open().
|
static |
Definition at line 6025 of file tun.c.
References CLEAR, D_TUNTAP_INFO, DEV_TYPE_TUN, tuntap::hand, M_FATAL, M_INFO, msg, PACKAGE_NAME, TAP_WIN_MIN_MAJOR, TAP_WIN_MIN_MINOR, and tuntap::type.
Referenced by tuntap_post_open().
|
static |
Definition at line 6612 of file tun.c.
References DEV_TYPE_TUN, tuntap::did_ifconfig_setup, tuntap_dhcp_mask(), tuntap_get_mtu(), tuntap_get_version_info(), tuntap_set_connected(), tuntap_set_ip_addr(), tuntap_set_ip_props(), tuntap_set_ptp(), tuntap::type, tuntap::windows_driver, and WINDOWS_DRIVER_TAP_WINDOWS6.
Referenced by open_tun().
|
static |
Definition at line 6267 of file tun.c.
References tuntap::hand, M_INFO, M_WARN, management_sleep(), msg, tuntap::options, status, and tuntap_options::tap_sleep.
Referenced by tuntap_post_open().
|
static |
Definition at line 6080 of file tun.c.
References tuntap::adapter_index, tuntap::adapter_netmask, D_TUNTAP_INFO, delete_temp_addresses(), tuntap_options::dhcp_pre_release, dhcp_release(), tuntap_options::dhcp_renew, dhcp_renew(), dhcp_status(), DHCP_STATUS_DISABLED, tuntap::did_ifconfig_setup, ack_message_t::error_number, fork_dhcp_action(), gc_free(), gc_new(), iface, tuntap_options::ip_win32_type, tuntap::ipapi_context, tuntap::ipapi_context_defined, tuntap::ipapi_instance, IPW32_SET_IPAPI, tuntap::local, M_FATAL, M_INFO, M_WARN, msg, tuntap_options::msg_channel, msg_flush_neighbors, tuntap::options, print_in_addr_t(), send_msg_iservice(), status, strerror_win32(), TUN_ADAPTER_INDEX_INVALID, tuntap::windows_driver, and WINDOWS_DRIVER_TAP_WINDOWS6.
Referenced by tuntap_post_open().
|
static |
Definition at line 6569 of file tun.c.
References tuntap::adapter_index, tuntap::adapter_netmask, dhcp_status(), DHCP_STATUS_DISABLED, DHCP_STATUS_ENABLED, tuntap_options::ip_win32_type, IPW32_SET_ADAPTIVE, IPW32_SET_DHCP_MASQ, tuntap::local, tuntap_options::msg_channel, netsh_enable_dhcp(), netsh_ifconfig(), NI_IP_NETMASK, NI_OPTIONS, NI_TEST_FIRST, tuntap::options, and service_enable_dhcp().
Referenced by tuntap_post_open().
|
static |
Definition at line 6287 of file tun.c.
References tuntap::did_ifconfig_ipv6_setup, tuntap::did_ifconfig_setup, gc_free(), gc_new(), tuntap::hand, IA_NET_ORDER, in_addr_t, tuntap::local, M_FATAL, M_INFO, msg, print_in_addr_t(), tuntap::remote_netmask, status, TOP_SUBNET, and tuntap::topology.
Referenced by tuntap_post_open().
Definition at line 4020 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 567 of file tun.c.
References route_gateway_address::addr, route_gateway_info::flags, route_gateway_info::gateway, gc_free(), gc_new(), get_default_gateway(), in_addr_t, M_WARN, msg, route_gateway_address::netmask, RGI_ADDR_DEFINED, and RGI_NETMASK_DEFINED.
Referenced by do_option_warnings(), and tuntap_ring_empty().
|
static |
Definition at line 5581 of file tun.c.
References gc_new(), M_INFO, M_WARN, msg, and strerror_win32().
Referenced by do_ifconfig_ipv4(), and do_ifconfig_ipv6().
|
static |
Definition at line 6215 of file tun.c.
References tuntap::hand, M_ERRNO, M_FATAL, M_NONFATAL, msg, tuntap_options::msg_channel, tuntap::options, rw_handle::read, register_ring_buffers(), tuntap::rw_handle, service_register_ring_buffers(), tuntap::wintun_receive_ring, tuntap::wintun_receive_ring_handle, tuntap::wintun_send_ring, tuntap::wintun_send_ring_handle, and rw_handle::write.
Referenced by tun_try_open_device().
|
static |
Definition at line 5771 of file tun.c.
References buf_safe(), buf_write(), buf_write_u8(), buffer::len, M_WARN, and msg.
Referenced by build_dhcp_options_string().
|
static |
Definition at line 5742 of file tun.c.
References buf_safe(), buf_write(), buf_write_u8(), buffer::len, M_WARN, and msg.
Referenced by build_dhcp_options_string().
|
static |
Definition at line 5713 of file tun.c.
References buf_safe(), buf_write_u32(), buf_write_u8(), buffer::len, M_WARN, and msg.
Referenced by build_dhcp_options_string().
|
static |
Definition at line 5699 of file tun.c.
References buf_safe(), buf_write_u8(), M_WARN, and msg.
Referenced by build_dhcp_options_string().
|
static |
Definition at line 61 of file tun.c.
Referenced by get_device_instance_id_interface().
|
static |
Definition at line 62 of file tun.c.
Referenced by get_device_instance_id_interface().
|
static |
Definition at line 424 of file tun.c.
Referenced by check_addr_clash(), and ifconfig_sanity_check().
|
static |