Go to the documentation of this file.
70 show_wait_status(
struct context *c)
136 if (sec < c->c2.timeval.tv_sec)
294 while (
BLEN(&buf) > 1)
298 int cmdlen = (int)strnlen(
BSTR(&buf),
BLEN(&buf));
300 if (cmdlen <
BLEN(&buf))
303 int cmdlen = (int)strlen(
BSTR(&buf)) + 1;
325 "message command without NUL termination");
367 #ifdef ENABLE_MANAGEMENT
391 if (!
do_up(c,
false, 0))
403 const char *str,
int msglevel)
414 msg(msglevel,
"SENT CONTROL [%s]: '%s' (status=%d)",
475 msg(
D_ROUTE,
"Route: Waiting for TUN/TAP interface to come up...");
526 msg(
M_INFO,
"Inactivity timeout (--inactive), exiting");
545 msg(
M_INFO,
"Server poll timeout, restarting");
593 #ifdef ENABLE_FRAGMENT
629 if (orig_buf == src_stub->
data && src_stub->
data != storage->
data)
632 *dest_stub = *storage;
636 *dest_stub = *src_stub;
649 const uint8_t *orig_buf = c->
c2.
buf.
data;
654 msg(
M_WARN,
"Attempting to send data packet while data channel offload is in use. "
673 if (c->
c2.comp_context)
675 (*c->
c2.comp_context->alg.compress)(&c->
c2.
buf, b->compress_buf, c->
c2.comp_context, &c->
c2.
frame);
678 #ifdef ENABLE_FRAGMENT
851 #ifdef ENABLE_MANAGEMENT
862 if (now < c->c2.coarse_timer_wakeup)
868 const struct timeval save = c->
c2.
timeval;
886 const int update_interval = 10;
939 if (size_delta > 0 && *size > size_delta)
976 if (port_share && socket_foreign_protocol_detected(c->
c2.
link_socket))
979 const int sd = socket_foreign_protocol_sd(c->
c2.
link_socket);
980 port_share_redirect(port_share, fbuf, sd);
1008 if (dco_win_timeout)
1023 bool decrypt_status =
false;
1029 #ifdef ENABLE_MEMSTATS
1036 #ifdef ENABLE_MANAGEMENT
1053 if (!ask_gremlin(c->
options.gremlin))
1065 fprintf(stderr,
"R");
1084 const uint8_t *ad_start = NULL;
1105 "Data Channel Offload doesn't support DATA_V1 packets. "
1106 "Upgrade your server to 2.4.5 or newer.");
1121 floated, &ad_start))
1164 return decrypt_status;
1172 #ifdef ENABLE_FRAGMENT
1181 if (c->
c2.comp_context)
1187 #ifdef PACKET_TRUNCATION_CHECK
1189 ipv4_packet_size_verify(
BPTR(&c->
c2.
buf),
1193 &c->
c2.n_trunc_post_decrypt);
1256 const uint8_t *orig_buf = c->
c2.
buf.
data;
1267 #if defined(ENABLE_DCO) && (defined(TARGET_LINUX) || defined(TARGET_FREEBSD))
1277 msg(
D_DCO_DEBUG,
"%s: received message for mismatching peer-id %d, "
1278 "expected %d", __func__, dco->dco_message_peer_id,
1283 switch (dco->dco_message_type)
1288 msg(
D_DCO_DEBUG,
"%s: received peer expired notification of for peer-id "
1289 "%d", __func__, dco->dco_message_peer_id);
1296 msg(
D_DCO_DEBUG,
"%s: received key rotation notification for peer-id %d",
1297 __func__, dco->dco_message_peer_id);
1302 msg(
D_DCO_DEBUG,
"%s: received message of type %u - ignoring", __func__,
1303 dco->dco_message_type);
1334 msg(
M_INFO,
"Wintun read error, restarting");
1350 #ifdef PACKET_TRUNCATION_CHECK
1351 ipv4_packet_size_verify(
BPTR(&c->
c2.
buf),
1355 &c->
c2.n_trunc_tun_read);
1362 msg(
M_INFO,
"TUN/TAP interface has been stopped, exiting");
1372 msg(
M_INFO,
"TUN/TAP I/O operation aborted, restarting");
1396 int ip_hdr_offset = 0;
1418 if (tun_sa.
addr.
sa.sa_family != AF_INET)
1431 else if (proto_ver == 6)
1442 if (tun_sa.
addr.
sa.sa_family != AF_INET6)
1461 msg(
D_LOW,
"Recursive routing detected, drop tun packet to %s",
1487 fprintf(stderr,
"r");
1508 #ifdef PACKET_TRUNCATION_CHECK
1510 ipv4_packet_size_verify(
BPTR(&c->
c2.
buf),
1514 &c->
c2.n_trunc_pre_encrypt);
1543 #define MAX_ICMPV6LEN 1280
1551 struct buffer inputipbuf = *buf;
1579 inet_pton(AF_INET6,
"fe80::7", &pip6out.
saddr);
1594 int totalheader_len = icmpheader_len;
1608 int payload_len =
min_int(max_payload_size,
BLEN(&inputipbuf));
1636 (
const uint8_t *)&pip6out.
saddr,
1663 #undef MAX_ICMPV6LEN
1673 #if PASSTOS_CAPABILITY
1694 struct buffer ipbuf = *buf;
1697 #if PASSTOS_CAPABILITY
1793 #if PASSTOS_CAPABILITY
1802 fprintf(stderr,
"W");
1831 #ifdef ENABLE_MEMSTATS
1837 #ifdef ENABLE_MANAGEMENT
1857 "TCP/UDP packet was truncated/expanded on write to %s (tried=%d,actual=%d)",
1872 bool unreachable = error_code ==
1878 if (size < 0 && unreachable && c->c2.tls_multi
1881 msg(
M_INFO,
"Network unreachable, restarting");
1889 msg(
D_LINK_ERRORS,
"TCP/UDP packet too large on write to %s (tried=%d,max=%d)",
1938 fprintf(stderr,
"w");
1943 #ifdef PACKET_TRUNCATION_CHECK
1948 &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
2071 unsigned int socket = 0;
2081 #ifdef ENABLE_MANAGEMENT
2084 #ifdef ENABLE_ASYNC_PUSH
2087 #if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
2197 #if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
2204 #ifdef ENABLE_MANAGEMENT
2211 #ifdef ENABLE_ASYNC_PUSH
2240 show_wait_status(c);
2255 for (i = 0; i <
status; ++i)
2289 #ifdef ENABLE_MANAGEMENT
static void check_timeout_random_component(struct context *c)
static bool buf_safe(const struct buffer *buf, size_t len)
struct event_timeout route_wakeup
static void process_incoming_dco(struct context *c)
unsigned int event_set_status
struct overlapped_io reads
int read_tun(struct tuntap *tt, uint8_t *buf, int len)
static void check_status_file(struct context *c)
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)
static int link_socket_read(struct link_socket *sock, struct buffer *buf, struct link_socket_actual *from)
@ OVPN_CMD_DEL_PEER
@OVPN_CMD_DEL_PEER: Remove peer from internal table
volatile int signal_received
union openvpn_sockaddr::@14 addr
#define IN6_ARE_ADDR_EQUAL(a, b)
void io_wait_dowork(struct context *c, const unsigned int flags)
static void check_connection_established(struct context *c)
static struct gc_arena gc_new(void)
static void check_session_timeout(struct context *c)
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.
static void check_timeout_random_component_dowork(struct context *c)
struct tls_multi * tls_multi
TLS state structure for this VPN tunnel.
static void process_coarse_timers(struct context *c)
bool route_gateway_via_dhcp
struct context_persist persist
Persistent context.
void management_socket_set(struct management *man, struct event_set *es, void *arg, unsigned int *persistent)
int len
Length in bytes of the actual content within the allocated memory.
static void buf_reset(struct buffer *buf)
static int tls_test_payload_len(const struct tls_multi *multi)
enum windows_driver_type windows_driver
int socks_process_outgoing_udp(struct buffer *buf, const struct link_socket_actual *to)
struct tuntap * tuntap
Tun/tap virtual network interface.
static bool tuntap_is_wintun(struct tuntap *tt)
const char * proto2ascii(int proto, sa_family_t af, bool display_form)
int64_t inactivity_minimum_bytes
#define KS_PRIMARY
Primary key state index.
counter_type link_write_bytes
void management_sleep(const int n)
A sleep function that services the management layer for n seconds rather than doing nothing.
static bool packet_id_persist_enabled(const struct packet_id_persist *p)
static void check_status(int status, const char *description, struct link_socket *sock, struct tuntap *tt)
#define buf_init(buf, offset)
Contains all state information for one tunnel.
static void interval_action(struct interval *top)
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 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...
struct tls_session session[TM_SIZE]
Array of tls_session objects representing control channel sessions with the remote peer.
struct event_timeout auth_token_renewal_interval
struct link_socket_addr * lsa
counter_type tun_read_bytes
long int get_random(void)
static void check_fragment(struct context *c)
struct plugin_list * plugins
List of plug-ins.
#define PERF_PROC_OUT_TUN
static void register_activity(struct context *c, const int size)
struct buffer alloc_buf_gc(size_t size, struct gc_arena *gc)
static bool tuntap_abort(int status)
#define CC_CRLF
carriage return or newline
static void check_send_occ_req(struct context *c)
static void interval_schedule_wakeup(struct interval *top, interval_t *wakeup)
void reset_coarse_timers(struct context *c)
struct event_timeout inactivity_interval
bool is_ipv6(int tunnel_type, struct buffer *buf)
void pre_select(struct context *c)
void process_ip_header(struct context *c, unsigned int flags, struct buffer *buf)
struct connection_entry ce
struct context_buffers * buffers
static bool link_socket_verify_incoming_addr(struct buffer *buf, const struct link_socket_info *info, const struct link_socket_actual *from_addr)
int dco_get_peer_stats(struct context *c)
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 void event_timeout_init(struct event_timeout *et, interval_t n, const time_t last)
Initialises a timer struct.
struct event_timeout route_wakeup_expire
struct buffer decrypt_buf
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 do_up(struct context *c, bool pulled_options, unsigned int option_types_found)
int dco_do_read(dco_context_t *dco)
struct link_socket_actual * to_link_addr
static bool link_socket_connection_oriented(const struct link_socket *sock)
static void event_timeout_modify_wakeup(struct event_timeout *et, interval_t n)
Sets the interval n of a timeout.
void management_check_bytecount(struct context *c, struct management *man, struct timeval *timeval)
Security parameter state of one TLS and data channel key session.
bool allow_recursive_routing
counter_type link_read_bytes
void process_outgoing_tun(struct context *c)
Write a packet to the virtual tun/tap network interface.
struct route_list * route_list
List of routing information.
struct event_timeout wait_for_connect
int get_server_poll_remaining_time(struct event_timeout *server_poll_timeout)
enum multi_status multi_state
static void tls_set_single_session(struct tls_multi *multi)
static void event_ctl(struct event_set *es, event_t event, unsigned int rwflags, void *arg)
static void check_push_request(struct context *c)
bool test_routes(const struct route_list *rl, const struct tuntap *tt)
struct context_2 c2
Level 2 context.
static bool tuntap_defined(const struct tuntap *tt)
#define TM_ACTIVE
Active tls_session.
static bool link_socket_actual_defined(const struct link_socket_actual *act)
static void check_tls_errors(struct context *c)
void tls_session_soft_reset(struct tls_multi *tls_multi)
void send_auth_failed(struct context *c, const char *client_reason)
static void buffer_turnover(const uint8_t *orig_buf, struct buffer *dest_stub, struct buffer *src_stub, struct buffer *storage)
counter_type link_read_bytes_global
static bool buf_advance(struct buffer *buf, int size)
struct client_nat_option_list * client_nat
void packet_id_persist_save(struct packet_id_persist *p)
void encrypt_sign(struct context *c, bool comp_frag)
Process a data channel packet that will be sent through a VPN tunnel.
static void check_coarse_timers(struct context *c)
#define PERF_PROC_OUT_LINK
void process_explicit_exit_notification_timer_wakeup(struct context *c)
bool schedule_exit(struct context *c)
static bool buf_write_prepend(struct buffer *dest, const void *src, int size)
bool send_push_request(struct context *c)
bool buf_assign(struct buffer *dest, const struct buffer *src)
void mss_fixup_ipv6(struct buffer *buf, uint16_t maxmss)
bool shaper_soonest_event(struct timeval *tv, int delay)
int payload_size
the maximum size that a payload that our buffers can hold from either tun device or network link.
#define CC_PRINT
printable (>= 32, != 127)
static void shaper_wrote_bytes(struct shaper *s, int nbytes)
static void update_time(void)
void server_pushed_signal(struct context *c, const struct buffer *buffer, const bool restart, const int adv)
static bool is_occ_msg(const struct buffer *buf)
void socks_process_incoming_udp(struct buffer *buf, struct link_socket_actual *from)
void process_received_occ_msg(struct context *c)
interval_t n
periodic interval for periodic timeouts
void reschedule_multi_process(struct context *c)
Reschedule tls_multi_process.
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...
static void perf_pop(void)
bool tun_standby(struct tuntap *tt)
static bool is_ping_msg(const struct buffer *buf)
static void check_ping_send(struct context *c)
struct options options
Options loaded from command line or configuration file.
struct route_ipv6_list * route_ipv6_list
bool tls_send_payload(struct key_state *ks, const uint8_t *data, int size)
void dco_event_set(dco_context_t *dco, struct event_set *es, void *arg)
void route_list_add_vpn_gateway(struct route_list *rl, struct env_set *es, const in_addr_t addr)
struct event_timeout ping_send_interval
static void process_incoming_link(struct context *c)
int dco_peer_id
This is the handle that DCO uses to identify this session with the kernel.
void read_incoming_tun(struct context *c)
Read a packet from the virtual tun/tap network interface.
in_addr_t dhcp_extract_router_msg(struct buffer *ipbuf)
static bool interval_test(struct interval *top)
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.
time_t explicit_exit_notification_time_wait
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.
static void check_ping_restart(struct context *c)
bool string_check_buf(struct buffer *buf, const unsigned int inclusive, const unsigned int exclusive)
Check a buffer if it only consists of allowed characters.
struct frame frame_fragment
counter_type tun_write_bytes
int scheduled_exit_interval
static void fragment_housekeeping(struct fragment_master *f, struct frame *frame, struct timeval *tv)
Perform housekeeping of a fragment_master structure.
static void check_send_occ_load_test(struct context *c)
static int link_socket_write(struct link_socket *sock, struct buffer *buf, struct link_socket_actual *to)
static struct link_socket_info * get_link_socket_info(struct context *c)
Wrapper structure for dynamically allocated memory.
static void check_tls_errors_nco(struct context *c)
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...
#define PERF_PROC_IN_LINK
time_t push_request_timeout
uint8_t source[OPENVPN_ETH_ALEN]
int scheduled_exit_signal
static void event_reset(struct event_set *es)
#define IOW_READ_TUN_FORCE
uint8_t dest[OPENVPN_ETH_ALEN]
struct link_socket_info info
#define PROTO_DUMP(buf, gc)
static bool buf_write(struct buffer *dest, const void *src, size_t size)
struct event_set * event_set
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)
@ OVPN_DEL_PEER_REASON_EXPIRED
struct buffer read_link_buf
static void check_scheduled_exit(struct context *c)
Security parameter state of a single session within a VPN tunnel.
struct timeval timeout_random_component
#define OPENVPN_STATE_GET_CONFIG
struct timeval timeval
Time to next event of timers and similar.
void show_adapters(int msglev)
int sockethandle_finalize(sockethandle_t sh, struct overlapped_io *io, struct buffer *buf, struct link_socket_actual *from)
struct event_timeout explicit_exit_notification_interval
struct event_timeout scheduled_exit
struct link_socket * link_socket
void link_socket_bad_incoming_addr(struct buffer *buf, const struct link_socket_info *info, const struct link_socket_actual *from_addr)
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.
int restart_sleep_seconds
void process_io(struct context *c)
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)
void show_routes(int msglev)
static void tv_add(struct timeval *dest, const struct timeval *src)
#define PIPV6_ICMP_NOHOST_SERVER
static void check_inactivity_timeout(struct context *c)
Garbage collection arena used to keep track of dynamically allocated memory.
static void check_tls(struct context *c)
struct signal_info * sig
Internal error signaling object.
#define MODE_POINT_TO_POINT
bool send_control_channel_string_dowork(struct tls_session *session, const char *str, int msglevel)
void check_dco_key_status(struct context *c)
static bool tls_initial_packet_received(const struct tls_multi *multi)
void client_nat_transform(const struct client_nat_option_list *list, struct buffer *ipbuf, const int direction)
struct link_socket_actual socks_relay
void mss_fixup_ipv4(struct buffer *buf, uint16_t maxmss)
static bool dco_enabled(const struct options *o)
Returns whether the current configuration has dco enabled.
static bool check_debug_level(unsigned int level)
static void parse_incoming_control_channel_command(struct context *c, struct buffer *buf)
static bool tuntap_is_dco_win_timeout(struct tuntap *tt, int status)
time_t update_timeout_random_component
bool buf_string_match_head_str(const struct buffer *src, const char *match)
struct event_timeout packet_id_persist_interval
static void management_bytes_client(struct management *man, const int size_in, const int size_out)
#define OPENVPN_IPPROTO_ICMPV6
#define IOW_CHECK_RESIDUAL
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.
struct man_def_auth_context mda_context
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.
uint16_t mss_fix
The actual MSS value that should be written to the payload packets.
counter_type link_write_bytes_global
static bool dco_update_keys(dco_context_t *dco, struct tls_multi *multi)
struct fragment_master * fragment
static int max_int(int x, int y)
unsigned int socket_set(struct link_socket *s, struct event_set *es, unsigned int rwflags, void *arg, unsigned int *persistent)
static void drop_if_recursive_routing(struct context *c, struct buffer *buf)
Drops UDP packets which OS decided to route via tun.
#define PUSH_REQUEST_INTERVAL
bool tls_rec_payload(struct tls_multi *multi, struct buffer *buf)
static void read_wintun(struct tuntap *tt, struct buffer *buf)
void receive_exit_message(struct context *c)
static int get_tun_ip_ver(int tunnel_type, struct buffer *buf, int *ip_hdr_offset)
static SERVICE_STATUS status
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)
void read_incoming_link(struct context *c)
Read a packet from the external network interface.
const char * print_link_socket_actual(const struct link_socket_actual *act, struct gc_arena *gc)
static int min_int(int x, int y)
static void gc_free(struct gc_arena *a)
void server_pushed_info(struct context *c, const struct buffer *buffer, const int adv)
static void check_tls_errors_co(struct context *c)
static bool socket_connection_reset(const struct link_socket *sock, int status)
#define PIPV4_EXTRACT_DHCP_ROUTER
struct crypto_options crypto_options
Security parameters and crypto state used by the Data Channel Crypto module to process data channel p...
struct buffer encrypt_buf
const char * tun_stat(const struct tuntap *tt, unsigned int rwflags, struct gc_arena *gc)
static void wait_signal(struct event_set *es, void *arg)
struct status_output * status_output
static bool socket_read_residual(const struct link_socket *s)
static void socks_postprocess_incoming_link(struct context *c)
static void check_server_poll_timeout(struct context *c)
struct link_socket_actual from
static void socks_preprocess_outgoing_link(struct context *c, struct link_socket_actual **to_addr, int *size_delta)
struct packet_id_persist pid_persist
static char * format_hex(const uint8_t *data, int size, int maxoutput, struct gc_arena *gc)
counter_type link_read_bytes_auth
const char * sanitize_control_message(const char *src, struct gc_arena *gc)
#define CC_NULL
null character \0
void tls_post_encrypt(struct tls_multi *multi, struct buffer *buf)
Perform some accounting for the key state used.
struct event_timeout push_request_interval
struct event_timeout server_poll_interval
static void get_signal(volatile int *sig)
Copy the global signal_received (if non-zero) to the passed-in argument sig.
void print_status(struct context *c, struct status_output *so)
static void context_reschedule_sec(struct context *c, int sec)
static int shaper_delay(struct shaper *s)
#define OPENVPN_ICMP6_DESTINATION_UNREACHABLE
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 tun_show_debug(struct tuntap *tt)
void receive_auth_failed(struct context *c, const struct buffer *buffer)
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.
static int datagram_overhead(sa_family_t af, int proto)
void receive_cr_response(struct context *c, const struct buffer *buffer)
#define PIPV6_ICMP_NOHOST_CLIENT
static void link_socket_write_post_size_adjust(int *size, int size_delta, struct buffer *buf)
struct event_timeout session_interval
static bool event_timeout_defined(const struct event_timeout *et)
bool is_ipv4(int tunnel_type, struct buffer *buf)
struct openvpn_sockaddr dest
static void event_timeout_clear(struct event_timeout *et)
Clears the timeout and reset all values to 0.
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.
struct buffer read_tun_buf
#define OPENVPN_ICMP6_DU_NOROUTE
struct event_timeout ping_rec_interval
void process_incoming_tun(struct context *c)
Process a packet read from the virtual tun/tap network interface.
void incoming_push_message(struct context *c, const struct buffer *buffer)
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.
time_t coarse_timer_wakeup
static void tun_set(struct tuntap *tt, struct event_set *es, unsigned int rwflags, void *arg, unsigned int *persistent)
static void interval_future_trigger(struct interval *top, interval_t wakeup)
void frame_adjust_path_mtu(struct context *c)
Checks and adjusts the fragment and mssfix value according to the discovered path mtu value.
static void link_socket_get_outgoing_addr(struct buffer *buf, const struct link_socket_info *info, struct link_socket_actual **act)
static void event_timeout_reset(struct event_timeout *et)
Resets a timer.
static void check_incoming_control_channel(struct context *c)
const char * socket_stat(const struct link_socket *s, unsigned int rwflags, struct gc_arena *gc)
static bool tuntap_stop(int status)
int tun_mtu
the (user) configured tun-mtu.
struct socks_proxy_info * socks_proxy
const char * ifconfig_ipv6_remote
void process_outgoing_link(struct context *c)
Write a packet to the external network interface.
static void perf_push(int type)
static void check_send_occ_msg(struct context *c)
bool buf_printf(struct buffer *buf, const char *format,...)
#define PERF_READ_IN_LINK
void management_io(struct management *man)
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.
const char * tv_string(const struct timeval *tv, struct gc_arena *gc)
static void check_add_routes_action(struct context *c, const bool errors)
void initialization_sequence_completed(struct context *c, const unsigned int flags)
int headroom
the headroom in the buffer, this is choosen to allow all potential header to be added before the pack...
static void check_add_routes(struct context *c)
static bool buf_copy_n(struct buffer *dest, struct buffer *src, int n)
static interval_t event_timeout_remaining(struct event_timeout *et)
Returns the time until the timeout should triggered, from now.
Security parameter state for processing data channel packets.
int write_tun(struct tuntap *tt, uint8_t *buf, int len)
static int event_wait(struct event_set *es, const struct timeval *tv, struct event_set_return *out, int outlen)
struct context_1 c1
Level 1 context.
static bool connection_established(struct context *c)
static void context_immediate_reschedule(struct context *c)
static int write_tun_buffered(struct tuntap *tt, struct buffer *buf)
#define OPENVPN_ETH_P_IPV6
uint8_t * data
Pointer to the allocated memory.
bool send_control_channel_string(struct context *c, const char *str, int msglevel)
static bool fragment_outgoing_defined(struct fragment_master *f)
Check whether a fragment_master structure contains fragments ready to be sent.
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...
openvpn_net_ctx_t net_ctx
Networking API opaque context.