66 for (
int i = 0;
i <
c->c1.link_sockets_num;
i++)
142 if (sec < c->c2.timeval.tv_sec)
299 while (
BLEN(&buf) > 1)
344 if (
c->c2.tls_multi &&
c->options.pull)
346#ifdef ENABLE_MANAGEMENT
361 if (
c->c2.push_request_timeout <
now)
363 c->c2.push_request_timeout =
now +
c->options.handshake_window;
382 const char *
str,
int msglevel)
393 msg(msglevel,
"SENT CONTROL [%s]: '%s' (status=%d)",
454 msg(
D_ROUTE,
"Route: Waiting for TUN/TAP interface to come up...");
504 msg(
M_INFO,
"Inactivity timeout (--inactive), exiting");
523 msg(
M_INFO,
"Server poll timeout, restarting");
571#ifdef ENABLE_FRAGMENT
608 if (orig_buf == src_stub->
data && src_stub->
data != storage->
data)
611 *dest_stub = *storage;
615 *dest_stub = *src_stub;
628 const uint8_t *orig_buf = c->
c2.
buf.
data;
633 msg(
M_WARN,
"Attempting to send data packet while data channel offload is in use. "
652 if (c->
c2.comp_context)
654 (*c->
c2.comp_context->alg.compress)(&c->
c2.
buf, b->compress_buf, c->
c2.comp_context, &c->
c2.
frame);
657#ifdef ENABLE_FRAGMENT
830#ifdef ENABLE_MANAGEMENT
841 if (now < c->c2.coarse_timer_wakeup)
847 const struct timeval save = c->
c2.
timeval;
865 const int update_interval = 10;
919 if (size_delta > 0 && *size > size_delta)
956 if (port_share && socket_foreign_protocol_detected(sock))
1003 bool decrypt_status =
false;
1009#ifdef ENABLE_MEMSTATS
1016#ifdef ENABLE_MANAGEMENT
1033 if (!ask_gremlin(c->
options.gremlin))
1045 fprintf(stderr,
"R");
1064 const uint8_t *ad_start = NULL;
1085 "Data Channel Offload doesn't support DATA_V1 packets. "
1086 "Upgrade your server to 2.4.5 or newer.");
1101 floated, &ad_start))
1146 return decrypt_status;
1154#ifdef ENABLE_FRAGMENT
1163 if (c->
c2.comp_context)
1169#ifdef PACKET_TRUNCATION_CHECK
1171 ipv4_packet_size_verify(
BPTR(&c->
c2.
buf),
1175 &c->
c2.n_trunc_post_decrypt);
1238 const uint8_t *orig_buf = c->
c2.
buf.
data;
1249#if defined(ENABLE_DCO) && (defined(TARGET_LINUX) || defined(TARGET_FREEBSD))
1259 msg(
D_DCO_DEBUG,
"%s: received message for mismatching peer-id %d, "
1260 "expected %d", __func__, dco->dco_message_peer_id,
1265 switch (dco->dco_message_type)
1272 msg(
D_DCO_DEBUG,
"%s: received peer expired notification of for peer-id "
1273 "%d", __func__, dco->dco_message_peer_id);
1280 msg(
D_DCO_DEBUG,
"%s: received key rotation notification for peer-id %d",
1281 __func__, dco->dco_message_peer_id);
1286 msg(
D_DCO_DEBUG,
"%s: received message of type %u - ignoring", __func__,
1287 dco->dco_message_type);
1318 msg(
M_INFO,
"Wintun read error, restarting");
1344#ifdef PACKET_TRUNCATION_CHECK
1345 ipv4_packet_size_verify(
BPTR(&c->
c2.
buf),
1349 &c->
c2.n_trunc_tun_read);
1356 msg(
M_INFO,
"TUN/TAP interface has been stopped, exiting");
1366 msg(
M_INFO,
"TUN/TAP I/O operation aborted, restarting");
1390 int ip_hdr_offset = 0;
1410 if (tun_sa.
addr.
sa.sa_family != AF_INET)
1418 if (memcmp(&tun_sa.
addr.
in4.sin_addr.s_addr, &pip->
daddr,
sizeof(pip->
daddr)) == 0)
1423 else if (proto_ver == 6)
1432 if (tun_sa.
addr.
sa.sa_family != AF_INET6)
1452 msg(
D_LOW,
"Recursive routing detected, drop tun packet to %s",
1478 fprintf(stderr,
"r");
1499#ifdef PACKET_TRUNCATION_CHECK
1501 ipv4_packet_size_verify(
BPTR(&c->
c2.
buf),
1505 &c->
c2.n_trunc_pre_encrypt);
1534#define MAX_ICMPV6LEN 1280
1570 inet_pton(AF_INET6,
"fe80::7", &pip6out.
saddr);
1585 int totalheader_len = icmpheader_len;
1599 int payload_len =
min_int(max_payload_size,
BLEN(&inputipbuf));
1607 c->c2.to_tun =
c->c2.buffers->aux_buf;
1612 c->c2.to_link =
c->c2.buffers->aux_buf;
1663 flags &= ~PIP_MSSFIX;
1665#if PASSTOS_CAPABILITY
1668 flags &= ~PIPV4_PASSTOS;
1673 flags &= ~PIPV4_CLIENT_NAT;
1677 flags &= ~PIPV4_EXTRACT_DHCP_ROUTER;
1689#if PASSTOS_CAPABILITY
1785#if PASSTOS_CAPABILITY
1787 link_socket_set_tos(sock);
1794 fprintf(stderr,
"W");
1825#ifdef ENABLE_MEMSTATS
1831#ifdef ENABLE_MANAGEMENT
1851 "TCP/UDP packet was truncated/expanded on write to %s (tried=%d,actual=%d)",
1866 bool unreachable = error_code ==
1872 if (size < 0 && unreachable && c->c2.tls_multi
1875 msg(
M_INFO,
"Network unreachable, restarting");
1883 msg(
D_LINK_ERRORS,
"TCP/UDP packet too large on write to %s (tried=%d,max=%d)",
1931 fprintf(stderr,
"w");
1936#ifdef PACKET_TRUNCATION_CHECK
1941 &c->
c2.n_trunc_tun_write);
1970 "TUN/TAP packet was destructively fragmented on write to %s (tried=%d,actual=%d)",
2050#ifdef ENABLE_FRAGMENT
2064 const unsigned int flags,
unsigned int *out_socket,
2065 unsigned int *out_tuntap)
2067 unsigned int socket = 0;
2175 *out_socket = socket;
2194 unsigned int out_socket, out_tuntap;
2207 unsigned int ret = 0;
2233 unsigned int ret = 0;
2256 unsigned int out_socket;
2257 unsigned int out_tuntap;
2262#ifdef ENABLE_MANAGEMENT
2265#ifdef ENABLE_ASYNC_PUSH
2268#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
2279#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
2286#ifdef ENABLE_MANAGEMENT
2293#ifdef ENABLE_ASYNC_PUSH
2322 show_wait_status(c);
2337 for (i = 0; i <
status; ++i)
2349 "io_work: non socket event delivered");
2353 shift = socket_shift;
2357 shift = (uintptr_t)e->
arg;
2391#ifdef ENABLE_MANAGEMENT
void check_send_auth_token(struct context *c)
Checks if the timer to resend the auth-token has expired and if a new auth-token should be send to th...
bool buf_printf(struct buffer *buf, const char *format,...)
bool buf_assign(struct buffer *dest, const struct buffer *src)
struct buffer alloc_buf_gc(size_t size, struct gc_arena *gc)
bool buf_string_match_head_str(const struct buffer *src, const char *match)
static bool buf_write_prepend(struct buffer *dest, const void *src, int size)
static bool buf_copy_n(struct buffer *dest, struct buffer *src, int n)
static void buf_reset(struct buffer *buf)
static bool buf_safe(const struct buffer *buf, size_t len)
static bool buf_advance(struct buffer *buf, int size)
static void gc_free(struct gc_arena *a)
#define buf_init(buf, offset)
static struct gc_arena gc_new(void)
void client_nat_transform(const struct client_nat_option_list *list, struct buffer *ipbuf, const int direction)
#define PUSH_REQUEST_INTERVAL
long int get_random(void)
static int dco_do_read(dco_context_t *dco)
static void dco_event_set(dco_context_t *dco, struct event_set *es, void *arg)
static bool dco_update_keys(dco_context_t *dco, struct tls_multi *multi)
static int dco_get_peer_stats(struct context *c, const bool raise_sigusr1_on_err)
in_addr_t dhcp_extract_router_msg(struct buffer *ipbuf)
static int event_wait(struct event_set *es, const struct timeval *tv, struct event_set_return *out, int outlen)
static void event_reset(struct event_set *es)
static void wait_signal(struct event_set *es, void *arg)
static void event_ctl(struct event_set *es, event_t event, unsigned int rwflags, void *arg)
counter_type link_write_bytes_global
static void check_inactivity_timeout(struct context *c)
void reschedule_multi_process(struct context *c)
Reschedule tls_multi_process.
int get_server_poll_remaining_time(struct event_timeout *server_poll_timeout)
static void check_fragment(struct context *c)
static void check_tls_errors(struct context *c)
static void check_scheduled_exit(struct context *c)
static void check_session_timeout(struct context *c)
bool send_control_channel_string_dowork(struct tls_session *session, const char *str, int msglevel)
void process_io(struct context *c, struct link_socket *sock)
static void context_reschedule_sec(struct context *c, int sec)
static void check_timeout_random_component(struct context *c)
bool schedule_exit(struct context *c)
static void process_coarse_timers(struct context *c)
static void check_connection_established(struct context *c)
static void check_timeout_random_component_dowork(struct context *c)
bool send_control_channel_string(struct context *c, const char *str, int msglevel)
static void buffer_turnover(const uint8_t *orig_buf, struct buffer *dest_stub, struct buffer *src_stub, struct buffer *storage)
static void check_tls_errors_nco(struct context *c)
void ipv6_send_icmp_unreachable(struct context *c, struct buffer *buf, bool client)
Forges a IPv6 ICMP packet with a no route to host error code from the IPv6 packet in buf and sends it...
void get_io_flags_udp(struct context *c, struct multi_io *multi_io, const unsigned int flags)
static void multi_io_process_flags(struct context *c, struct event_set *es, const unsigned int flags, unsigned int *out_socket, unsigned int *out_tuntap)
void pre_select(struct context *c)
static void check_incoming_control_channel(struct context *c)
static void check_add_routes(struct context *c)
static void check_server_poll_timeout(struct context *c)
static void parse_incoming_control_channel_command(struct context *c, struct buffer *buf)
static void socks_postprocess_incoming_link(struct context *c, struct link_socket *sock)
static void check_push_request(struct context *c)
static void process_incoming_link(struct context *c, struct link_socket *sock)
static void check_tls_errors_co(struct context *c)
static void socks_preprocess_outgoing_link(struct context *c, struct link_socket *sock, struct link_socket_actual **to_addr, int *size_delta)
static void link_socket_write_post_size_adjust(int *size, int size_delta, struct buffer *buf)
void get_io_flags_dowork_udp(struct context *c, struct multi_io *multi_io, const unsigned int flags)
static void context_immediate_reschedule(struct context *c)
static void check_add_routes_action(struct context *c, const bool errors)
static void drop_if_recursive_routing(struct context *c, struct buffer *buf)
Drops UDP packets which OS decided to route via tun.
counter_type link_read_bytes_global
static void check_coarse_timers(struct context *c)
void check_dco_key_status(struct context *c)
void io_wait_dowork(struct context *c, const unsigned int flags)
static void process_incoming_dco(struct context *c)
void process_ip_header(struct context *c, unsigned int flags, struct buffer *buf, struct link_socket *sock)
static void check_tls(struct context *c)
static void check_status_file(struct context *c)
Interface functions to the internal and external multiplexers.
#define PIPV4_EXTRACT_DHCP_ROUTER
#define PIPV6_ICMP_NOHOST_SERVER
#define PIPV6_ICMP_NOHOST_CLIENT
static struct link_socket_info * get_link_socket_info(struct context *c)
#define IOW_CHECK_RESIDUAL
static bool connection_established(struct context *c)
static void register_activity(struct context *c, const int size)
#define IOW_READ_TUN_FORCE
#define KS_PRIMARY
Primary key state index.
#define TM_ACTIVE
Active tls_session.
void encrypt_sign(struct context *c, bool comp_frag)
Process a data channel packet that will be sent through a VPN tunnel.
void tls_post_encrypt(struct tls_multi *multi, struct buffer *buf)
Perform some accounting for the key state used.
void openvpn_encrypt(struct buffer *buf, struct buffer work, struct crypto_options *opt)
Encrypt and HMAC sign a packet so that it can be sent as a data channel VPN tunnel packet to a remote...
void tls_prepend_opcode_v1(const struct tls_multi *multi, struct buffer *buf)
Prepend a one-byte OpenVPN data channel P_DATA_V1 opcode to the packet.
void tls_pre_encrypt(struct tls_multi *multi, struct buffer *buf, struct crypto_options **opt)
Choose the appropriate security parameters with which to process an outgoing packet.
void tls_prepend_opcode_v2(const struct tls_multi *multi, struct buffer *buf)
Prepend an OpenVPN data channel P_DATA_V2 header to the packet.
bool openvpn_decrypt(struct buffer *buf, struct buffer work, struct crypto_options *opt, const struct frame *frame, const uint8_t *ad_start)
HMAC verify and decrypt a data channel packet received from a remote OpenVPN peer.
bool process_incoming_link_part1(struct context *c, struct link_socket_info *lsi, bool floated)
Starts processing a packet read from the external network interface.
void process_incoming_link_part2(struct context *c, struct link_socket_info *lsi, const uint8_t *orig_buf)
Continues processing a packet read from the external network interface.
void process_outgoing_link(struct context *c, struct link_socket *sock)
Write a packet to the external network interface.
void read_incoming_link(struct context *c, struct link_socket *sock)
Read a packet from the external network interface.
bool tls_pre_decrypt(struct tls_multi *multi, const struct link_socket_actual *from, struct buffer *buf, struct crypto_options **opt, bool floated, const uint8_t **ad_start)
Determine whether an incoming packet is a data channel or control channel packet, and process accordi...
static void fragment_housekeeping(struct fragment_master *f, struct frame *frame, struct timeval *tv)
Perform housekeeping of a fragment_master structure.
static bool fragment_outgoing_defined(struct fragment_master *f)
Check whether a fragment_master structure contains fragments ready to be sent.
void fragment_outgoing(struct fragment_master *f, struct buffer *buf, const struct frame *frame)
Process an outgoing packet, which may or may not need to be fragmented.
void fragment_incoming(struct fragment_master *f, struct buffer *buf, const struct frame *frame)
Process an incoming packet, which may or may not be fragmented.
bool fragment_ready_to_send(struct fragment_master *f, struct buffer *buf, const struct frame *frame)
Check whether outgoing fragments are ready to be send, and if so make one available.
void read_incoming_tun(struct context *c)
Read a packet from the virtual tun/tap network interface.
void process_incoming_tun(struct context *c, struct link_socket *out_sock)
Process a packet read from the virtual tun/tap network interface.
void process_outgoing_tun(struct context *c, struct link_socket *in_sock)
Write a packet to the virtual tun/tap network interface.
void initialization_sequence_completed(struct context *c, const unsigned int flags)
void reset_coarse_timers(struct context *c)
bool do_up(struct context *c, bool pulled_options, unsigned int option_types_found)
bool do_route(const struct options *options, struct route_list *route_list, struct route_ipv6_list *route_ipv6_list, const struct tuntap *tt, const struct plugin_list *plugins, struct env_set *es, openvpn_net_ctx_t *ctx)
static int min_int(int x, int y)
static int max_int(int x, int y)
static SERVICE_STATUS status
bool event_timeout_trigger(struct event_timeout *et, struct timeval *tv, const int et_const_retry)
This is the principal function for testing and triggering recurring timers.
static void interval_future_trigger(struct interval *top, interval_t wakeup)
static void event_timeout_reset(struct event_timeout *et)
Resets a timer.
static void interval_action(struct interval *top)
static bool event_timeout_defined(const struct event_timeout *et)
static void event_timeout_init(struct event_timeout *et, interval_t n, const time_t last)
Initialises a timer struct.
static void event_timeout_clear(struct event_timeout *et)
Clears the timeout and reset all values to 0.
static void interval_schedule_wakeup(struct interval *top, interval_t *wakeup)
static void event_timeout_modify_wakeup(struct event_timeout *et, interval_t n)
Sets the interval n of a timeout.
static bool interval_test(struct interval *top)
static interval_t event_timeout_remaining(struct event_timeout *et)
Returns the time until the timeout should triggered, from now.
void management_check_bytecount(struct context *c, struct management *man, struct timeval *timeval)
void management_socket_set(struct management *man, struct event_set *es, void *arg, unsigned int *persistent)
void management_set_state(struct management *man, const int state, const char *detail, const in_addr_t *tun_local_ip, const struct in6_addr *tun_local_ip6, const struct openvpn_sockaddr *local, const struct openvpn_sockaddr *remote)
void management_io(struct management *man)
void management_sleep(const int n)
A sleep function that services the management layer for n seconds rather than doing nothing.
static void management_bytes_server(struct management *man, const counter_type *bytes_in_total, const counter_type *bytes_out_total, struct man_def_auth_context *mdac)
static void management_bytes_client(struct management *man, const int size_in, const int size_out)
#define OPENVPN_STATE_GET_CONFIG
const char * sanitize_control_message(const char *src, struct gc_arena *gc)
void mss_fixup_ipv6(struct buffer *buf, uint16_t maxmss)
void mss_fixup_ipv4(struct buffer *buf, uint16_t maxmss)
void frame_adjust_path_mtu(struct context *c)
Checks and adjusts the fragment and mssfix value according to the discovered path mtu value.
void process_received_occ_msg(struct context *c)
static void check_send_occ_msg(struct context *c)
static bool is_occ_msg(const struct buffer *buf)
static void check_send_occ_req(struct context *c)
static void check_send_occ_load_test(struct context *c)
static bool check_debug_level(unsigned int level)
static void check_status(int status, const char *description, struct link_socket *sock, struct tuntap *tt)
#define PROTO_DUMP(buf, gc)
#define MODE_POINT_TO_POINT
static bool dco_enabled(const struct options *o)
Returns whether the current configuration has dco enabled.
const char * tv_string(const struct timeval *tv, struct gc_arena *gc)
static void update_time(void)
static void tv_add(struct timeval *dest, const struct timeval *src)
@ OVPN_CMD_DEL_PEER
@OVPN_CMD_DEL_PEER: Remove peer from internal table
@ OVPN_DEL_PEER_REASON_EXPIRED
void packet_id_persist_save(struct packet_id_persist *p)
static bool packet_id_persist_enabled(const struct packet_id_persist *p)
static void perf_push(int type)
#define PERF_PROC_OUT_TUN
#define PERF_PROC_OUT_LINK
#define PERF_PROC_IN_LINK
static void perf_pop(void)
#define PERF_READ_IN_LINK
void trigger_ping_timeout_signal(struct context *c)
Trigger the correct signal on a –ping timeout depending if –ping-exit is set (SIGTERM) or not (SIGUSR...
static void check_ping_restart(struct context *c)
static bool is_ping_msg(const struct buffer *buf)
static void check_ping_send(struct context *c)
bool is_ipv4(int tunnel_type, struct buffer *buf)
bool is_ipv6(int tunnel_type, struct buffer *buf)
uint16_t ip_checksum(const sa_family_t af, const uint8_t *payload, const int len_payload, const uint8_t *src_addr, const uint8_t *dest_addr, const int proto)
Calculates an IP or IPv6 checksum with a pseudo header as required by TCP, UDP and ICMPv6.
static int get_tun_ip_ver(int tunnel_type, struct buffer *buf, int *ip_hdr_offset)
#define OPENVPN_ETH_P_IPV6
#define OPENVPN_IPPROTO_ICMPV6
#define OPENVPN_IN6_ARE_ADDR_EQUAL(a, b)
Version of IN6_ARE_ADDR_EQUAL that is guaranteed to work for unaligned access.
#define OPENVPN_ICMP6_DESTINATION_UNREACHABLE
#define OPENVPN_ICMP6_DU_NOROUTE
void receive_auth_pending(struct context *c, const struct buffer *buffer)
Parses an AUTH_PENDING message and if in pull mode extends the timeout.
void receive_auth_failed(struct context *c, const struct buffer *buffer)
void server_pushed_signal(struct context *c, const struct buffer *buffer, const bool restart, const int adv)
void receive_cr_response(struct context *c, const struct buffer *buffer)
void send_auth_failed(struct context *c, const char *client_reason)
void receive_exit_message(struct context *c)
bool send_push_request(struct context *c)
void incoming_push_message(struct context *c, const struct buffer *buffer)
void server_pushed_info(const struct buffer *buffer, const int adv)
bool test_routes(const struct route_list *rl, const struct tuntap *tt)
void show_routes(int msglev)
void route_list_add_vpn_gateway(struct route_list *rl, struct env_set *es, const in_addr_t addr)
bool shaper_soonest_event(struct timeval *tv, int delay)
static void shaper_wrote_bytes(struct shaper *s, int nbytes)
static int shaper_delay(struct shaper *s)
void print_status(struct context *c, struct status_output *so)
void process_explicit_exit_notification_timer_wakeup(struct context *c)
void register_signal(struct signal_info *si, int signum, const char *signal_text)
Register a soft signal in the signal_info struct si respecting priority.
static void get_signal(volatile int *sig)
Copy the global signal_received (if non-zero) to the passed-in argument sig.
const char * proto2ascii(int proto, sa_family_t af, bool display_form)
const char * socket_stat(const struct link_socket *s, unsigned int rwflags, struct gc_arena *gc)
const char * print_link_socket_actual(const struct link_socket_actual *act, struct gc_arena *gc)
int sockethandle_finalize(sockethandle_t sh, struct overlapped_io *io, struct buffer *buf, struct link_socket_actual *from)
unsigned int socket_set(struct link_socket *s, struct event_set *es, unsigned int rwflags, void *arg, unsigned int *persistent)
void link_socket_bad_incoming_addr(struct buffer *buf, const struct link_socket_info *info, const struct link_socket_actual *from_addr)
bool sockets_read_residual(const struct context *c)
static bool link_socket_actual_defined(const struct link_socket_actual *act)
static int datagram_overhead(sa_family_t af, int proto)
static ssize_t link_socket_write(struct link_socket *sock, struct buffer *buf, struct link_socket_actual *to)
static bool link_socket_connection_oriented(const struct link_socket *sock)
static bool socket_connection_reset(const struct link_socket *sock, int status)
static bool link_socket_verify_incoming_addr(struct buffer *buf, const struct link_socket_info *info, const struct link_socket_actual *from_addr)
static void link_socket_set_outgoing_addr(struct link_socket_info *info, const struct link_socket_actual *act, const char *common_name, struct env_set *es)
static int link_socket_read(struct link_socket *sock, struct buffer *buf, struct link_socket_actual *from)
static void link_socket_get_outgoing_addr(struct buffer *buf, const struct link_socket_info *info, struct link_socket_actual **act)
int socks_process_outgoing_udp(struct buffer *buf, const struct link_socket_actual *to)
void socks_process_incoming_udp(struct buffer *buf, struct link_socket_actual *from)
bool tls_send_payload(struct key_state *ks, const uint8_t *data, int size)
bool tls_rec_payload(struct tls_multi *multi, struct buffer *buf)
void tls_session_soft_reset(struct tls_multi *tls_multi)
int tls_multi_process(struct tls_multi *multi, struct buffer *to_link, struct link_socket_actual **to_link_addr, struct link_socket_info *to_link_socket_info, interval_t *wakeup)
static bool tls_initial_packet_received(const struct tls_multi *multi)
static void tls_set_single_session(struct tls_multi *multi)
static int tls_test_payload_len(const struct tls_multi *multi)
struct buffer extract_command_buffer(struct buffer *buf, struct gc_arena *gc)
Extracts a control channel message from buf and adjusts the size of buf after the message has been ex...
Control Channel Verification Module.
Wrapper structure for dynamically allocated memory.
uint8_t * data
Pointer to the allocated memory.
int len
Length in bytes of the actual content within the allocated memory.
struct status_output * status_output
struct route_list * route_list
List of routing information.
struct route_ipv6_list * route_ipv6_list
struct packet_id_persist pid_persist
struct tuntap * tuntap
Tun/tap virtual network interface.
counter_type link_read_bytes
counter_type link_write_bytes
struct event_timeout server_poll_interval
struct fragment_master * fragment
time_t update_timeout_random_component
unsigned int event_set_status
struct event_timeout route_wakeup_expire
struct event_timeout ping_send_interval
struct timeval timeout_random_component
counter_type tun_read_bytes
struct man_def_auth_context mda_context
struct event_timeout scheduled_exit
struct event_timeout auth_token_renewal_interval
struct event_timeout wait_for_connect
struct event_timeout push_request_interval
struct tls_multi * tls_multi
TLS state structure for this VPN tunnel.
time_t coarse_timer_wakeup
int scheduled_exit_signal
struct link_socket_actual from
struct frame frame_fragment
struct crypto_options crypto_options
Security parameters and crypto state used by the Data Channel Crypto module to process data channel p...
counter_type tun_write_bytes
struct link_socket ** link_sockets
counter_type link_read_bytes_auth
struct event_timeout packet_id_persist_interval
struct link_socket_actual * to_link_addr
struct event_timeout session_interval
struct timeval timeval
Time to next event of timers and similar.
time_t explicit_exit_notification_time_wait
struct event_set * event_set
struct context_buffers * buffers
struct event_timeout route_wakeup
struct event_timeout inactivity_interval
struct event_timeout ping_rec_interval
struct buffer read_link_buf
struct buffer encrypt_buf
struct buffer read_tun_buf
struct buffer decrypt_buf
int restart_sleep_seconds
Contains all state information for one tunnel.
struct signal_info * sig
Internal error signaling object.
openvpn_net_ctx_t net_ctx
Networking API opaque context.
struct plugin_list * plugins
List of plug-ins.
struct context_2 c2
Level 2 context.
struct options options
Options loaded from command line or configuration file.
struct context_1 c1
Level 1 context.
struct context_persist persist
Persistent context.
Security parameter state for processing data channel packets.
struct link_socket * sock
interval_t n
periodic interval for periodic timeouts
int tun_mtu
the (user) configured tun-mtu.
int payload_size
the maximum size that a payload that our buffers can hold from either tun device or network link.
int headroom
the headroom in the buffer, this is choosen to allow all potential header to be added before the pack...
Garbage collection arena used to keep track of dynamically allocated memory.
Security parameter state of one TLS and data channel key session.
struct openvpn_sockaddr dest
struct link_socket_addr * lsa
struct link_socket_actual socks_relay
struct link_socket_info info
struct socks_proxy_info * socks_proxy
struct event_arg ev_arg
this struct will store a pointer to either mi or link_socket, depending on the event type,...
uint8_t dest[OPENVPN_ETH_ALEN]
uint8_t source[OPENVPN_ETH_ALEN]
union openvpn_sockaddr::@20 addr
const char * ifconfig_ipv6_remote
int scheduled_exit_interval
bool allow_recursive_routing
int64_t inactivity_minimum_bytes
struct connection_entry ce
bool route_gateway_via_dhcp
struct client_nat_option_list * client_nat
volatile int signal_received
enum multi_status multi_state
struct tls_session session[TM_SIZE]
Array of tls_session objects representing control channel sessions with the remote peer.
int dco_peer_id
This is the handle that DCO uses to identify this session with the kernel.
Security parameter state of a single session within a VPN tunnel.
enum tun_driver_type backend_driver
The backend driver that used for this tun/tap device.
struct overlapped_io reads
void tun_show_debug(struct tuntap *tt)
const char * tun_stat(const struct tuntap *tt, unsigned int rwflags, struct gc_arena *gc)
void show_adapters(int msglev)
bool tun_standby(struct tuntap *tt)
static bool tuntap_abort(int status)
static void read_wintun(struct tuntap *tt, struct buffer *buf)
static bool tuntap_is_wintun(struct tuntap *tt)
static int write_tun_buffered(struct tuntap *tt, struct buffer *buf)
static bool tuntap_defined(const struct tuntap *tt)
@ DRIVER_AFUNIX
using an AF_UNIX socket to pass packets from/to an external program.
static void tun_set(struct tuntap *tt, struct event_set *es, unsigned int rwflags, void *arg, unsigned int *persistent)
int read_tun(struct tuntap *tt, uint8_t *buf, int len)
static bool tuntap_is_dco_win_timeout(struct tuntap *tt, int status)
static bool tuntap_stop(int status)
int write_tun(struct tuntap *tt, uint8_t *buf, int len)
ssize_t read_tun_afunix(struct tuntap *tt, uint8_t *buf, int len)
Reads a packet from a AF_UNIX based tun device.
ssize_t write_tun_afunix(struct tuntap *tt, uint8_t *buf, int len)
Writes a packet to a AF_UNIX based tun device.