OpenVPN
|
Go to the source code of this file.
Macros | |
#define | TUN_OUT(c) (BLEN(&(c)->c2.to_tun) > 0) |
#define | LINK_OUT(c) (BLEN(&(c)->c2.to_link) > 0) |
#define | ANY_OUT(c) (TUN_OUT(c) || LINK_OUT(c)) |
#define | TO_LINK_FRAG(c) ((c)->c2.fragment && fragment_outgoing_defined((c)->c2.fragment)) |
#define | TO_LINK_DEF(c) (LINK_OUT(c) || TO_LINK_FRAG(c)) |
#define | IOW_TO_TUN (1<<0) |
#define | IOW_TO_LINK (1<<1) |
#define | IOW_READ_TUN (1<<2) |
#define | IOW_READ_LINK (1<<3) |
#define | IOW_SHAPER (1<<4) |
#define | IOW_CHECK_RESIDUAL (1<<5) |
#define | IOW_FRAG (1<<6) |
#define | IOW_MBUF (1<<7) |
#define | IOW_READ_TUN_FORCE (1<<8) |
#define | IOW_WAIT_SIGNAL (1<<9) |
#define | IOW_READ (IOW_READ_TUN|IOW_READ_LINK) |
#define | PIPV4_PASSTOS (1<<0) |
#define | PIP_MSSFIX (1<<1) /* v4 and v6 */ |
#define | PIP_OUTGOING (1<<2) |
#define | PIPV4_EXTRACT_DHCP_ROUTER (1<<3) |
#define | PIPV4_CLIENT_NAT (1<<4) |
#define | PIPV6_ICMP_NOHOST_CLIENT (1<<5) |
#define | PIPV6_ICMP_NOHOST_SERVER (1<<6) |
Functions | |
void | io_wait_dowork (struct context *c, const unsigned int flags) |
void | pre_select (struct context *c) |
void | process_io (struct context *c) |
void | encrypt_sign (struct context *c, bool comp_frag) |
Process a data channel packet that will be sent through a VPN tunnel. More... | |
int | get_server_poll_remaining_time (struct event_timeout *server_poll_timeout) |
void | read_incoming_link (struct context *c) |
Read a packet from the external network interface. More... | |
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. More... | |
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. More... | |
void | process_outgoing_link (struct context *c) |
Write a packet to the external network interface. More... | |
void | read_incoming_tun (struct context *c) |
Read a packet from the virtual tun/tap network interface. More... | |
void | process_incoming_tun (struct context *c) |
Process a packet read from the virtual tun/tap network interface. More... | |
void | process_outgoing_tun (struct context *c) |
Write a packet to the virtual tun/tap network interface. More... | |
bool | send_control_channel_string (struct context *c, const char *str, int msglevel) |
bool | send_control_channel_string_dowork (struct tls_session *session, const char *str, int msglevel) |
void | reschedule_multi_process (struct context *c) |
Reschedule tls_multi_process. More... | |
void | process_ip_header (struct context *c, unsigned int flags, struct buffer *buf) |
bool | schedule_exit (struct context *c) |
static struct link_socket_info * | get_link_socket_info (struct context *c) |
static void | register_activity (struct context *c, const int size) |
static unsigned int | p2p_iow_flags (const struct context *c) |
static void | io_wait (struct context *c, const unsigned int flags) |
static bool | connection_established (struct context *c) |
Variables | |
counter_type | link_read_bytes_global |
counter_type | link_write_bytes_global |
Interface functions to the internal and external multiplexers.
Definition in file forward.h.
#define IOW_READ (IOW_READ_TUN|IOW_READ_LINK) |
#define TO_LINK_DEF | ( | c | ) | (LINK_OUT(c) || TO_LINK_FRAG(c)) |
#define TO_LINK_FRAG | ( | c | ) | ((c)->c2.fragment && fragment_outgoing_defined((c)->c2.fragment)) |
|
inlinestatic |
Definition at line 417 of file forward.h.
References context::c2, CAS_WAITING_OPTIONS_IMPORT, link_socket_info::connection_established, get_link_socket_info(), tls_multi::multi_state, and context_2::tls_multi.
Referenced by check_connection_established(), and check_send_occ_load_test_dowork().
|
inlinestatic |
Definition at line 309 of file forward.h.
References context::c2, link_socket::info, context_2::link_socket, and context_2::link_socket_info.
Referenced by check_fragment(), check_tls(), connection_established(), do_deferred_options_part2(), do_deferred_p2p_ncp(), do_init_fragment(), encrypt_sign(), frame_adjust_path_mtu(), init_instance(), initialization_sequence_completed(), multi_client_connect_setenv(), multi_client_disconnect_setenv(), multi_client_generate_tls_keys(), multi_process_incoming_link(), and process_incoming_link().
int get_server_poll_remaining_time | ( | struct event_timeout * | server_poll_timeout | ) |
Definition at line 531 of file forward.c.
References event_timeout_remaining(), max_int(), and update_time().
Referenced by create_socket_dco_win(), establish_http_proxy_passthru(), phase2_socks_client(), phase2_tcp_client(), recv_socks_reply(), socks_handshake(), and socks_username_password_auth().
|
inlinestatic |
Definition at line 365 of file forward.h.
References context::c1, context::c2, context_2::event_set_status, context_2::fast_io, io_wait_dowork(), IOW_MBUF, IOW_READ_TUN, IOW_TO_LINK, IOW_TO_TUN, SOCKET_WRITE, TUN_READ, TUN_WRITE, context_1::tuntap, and tuntap_is_wintun().
Referenced by multi_tcp_wait_lite(), tunnel_point_to_point(), and tunnel_server_udp().
void io_wait_dowork | ( | struct context * | c, |
const unsigned int | flags | ||
) |
Definition at line 2069 of file forward.c.
References event_set_return::arg, context::c1, context::c2, check_debug_level(), check_status(), D_EVENT_WAIT, tuntap::dco, dco_event_set(), DCO_SHIFT, context_2::did_open_tun, dmsg, ERR_SHIFT, ES_ERROR, ES_TIMEOUT, event_ctl(), EVENT_READ, event_reset(), context_2::event_set, context_2::event_set_status, event_wait(), EVENT_WRITE, FILE_SHIFT, get_signal(), IOW_CHECK_RESIDUAL, IOW_FRAG, IOW_MBUF, IOW_READ_LINK, IOW_READ_TUN, IOW_READ_TUN_FORCE, IOW_SHAPER, IOW_TO_LINK, IOW_TO_TUN, IOW_WAIT_SIGNAL, context_2::link_socket, MANAGEMENT_SHIFT, management_socket_set(), max_int(), options::mode, MODE_SERVER, context::options, event_set_return::rwflags, context_2::shaper, options::shaper, shaper_delay(), shaper_soonest_event(), context::sig, signal_info::signal_received, SIZE, SOCKET_READ, socket_read_residual(), socket_set(), SOCKET_SHIFT, status, context_2::timeval, TO_LINK_FRAG, tun_set(), TUN_SHIFT, context_1::tuntap, tuntap_is_wintun(), update_time(), and wait_signal().
Referenced by io_wait().
|
inlinestatic |
Definition at line 340 of file forward.h.
References context::c1, context::c2, IOW_CHECK_RESIDUAL, IOW_FRAG, IOW_READ, IOW_READ_TUN, IOW_SHAPER, IOW_TO_LINK, IOW_TO_TUN, IOW_WAIT_SIGNAL, buffer::len, context_2::to_link, context_2::to_tun, context_1::tuntap, and tuntap_ring_empty().
Referenced by tunnel_point_to_point().
void pre_select | ( | struct context * | c | ) |
Definition at line 1997 of file forward.c.
References BIG_TIMEOUT, context::c1, context::c2, check_coarse_timers(), check_debug_level(), check_fragment(), check_incoming_control_channel(), check_send_occ_msg(), check_timeout_random_component(), check_tls(), check_tls_errors(), D_TAP_WIN_DEBUG, context_2::fragment, context::sig, signal_info::signal_received, context_2::timeval, context_2::tls_multi, tls_test_payload_len(), tun_show_debug(), context_1::tuntap, and tuntap_defined().
Referenced by multi_process_post(), and tunnel_point_to_point().
void process_io | ( | struct context * | c | ) |
Definition at line 2285 of file forward.c.
References ASSERT, context::c2, DCO_READ, context_2::event_set_status, IS_SIG, management_io(), MANAGEMENT_READ, MANAGEMENT_WRITE, process_incoming_dco(), process_incoming_link(), process_incoming_tun(), process_outgoing_link(), process_outgoing_tun(), read_incoming_link(), read_incoming_tun(), SOCKET_READ, SOCKET_WRITE, status, TUN_READ, and TUN_WRITE.
Referenced by tunnel_point_to_point().
Definition at line 1667 of file forward.c.
References options::block_ipv6, context::c1, context::c2, options::ce, options::client_nat, client_nat_transform(), CN_INCOMING, CN_OUTGOING, dhcp_extract_router_msg(), context_2::es, context_2::frame, ipv6_send_icmp_unreachable(), is_ipv4(), is_ipv6(), buffer::len, context_2::link_socket, frame::mss_fix, mss_fixup_ipv4(), mss_fixup_ipv6(), connection_entry::mssfix, context::options, PIP_MSSFIX, PIP_OUTGOING, PIPV4_CLIENT_NAT, PIPV4_EXTRACT_DHCP_ROUTER, PIPV4_PASSTOS, PIPV6_ICMP_NOHOST_CLIENT, PIPV6_ICMP_NOHOST_SERVER, options::route_gateway_via_dhcp, context_1::route_list, route_list_add_vpn_gateway(), TUNNEL_TYPE, and context_1::tuntap.
Referenced by multi_get_queue(), process_incoming_tun(), and process_outgoing_tun().
|
inlinestatic |
Definition at line 322 of file forward.h.
References context::c2, event_timeout_reset(), context_2::inactivity_bytes, context_2::inactivity_interval, options::inactivity_minimum_bytes, options::inactivity_timeout, and context::options.
Referenced by multi_process_incoming_link(), process_outgoing_link(), and process_outgoing_tun().
void reschedule_multi_process | ( | struct context * | c | ) |
Reschedule tls_multi_process.
NOTE: in multi-client mode, usually calling the function is insufficient to reschedule the client instance object unless multi_schedule_context_wakeup(m, mi) is also called.
Definition at line 424 of file forward.c.
References context::c2, context_immediate_reschedule(), interval_action(), and context_2::tmp_int.
Referenced by management_client_pending_auth(), send_auth_failed(), and send_control_channel_string().
bool schedule_exit | ( | struct context * | c | ) |
Definition at line 555 of file forward.c.
References context::c2, D_SCHED_EXIT, event_timeout_defined(), event_timeout_init(), msg, now, context::options, reset_coarse_timers(), context_2::scheduled_exit, options::scheduled_exit_interval, context_2::scheduled_exit_signal, context_2::tls_multi, tls_set_single_session(), and update_time().
Referenced by receive_exit_message(), send_auth_failed(), and send_restart().
bool send_control_channel_string | ( | struct context * | c, |
const char * | str, | ||
int | msglevel | ||
) |
Definition at line 431 of file forward.c.
References context::c2, reschedule_multi_process(), send_control_channel_string_dowork(), tls_multi::session, context_2::tls_multi, and TM_ACTIVE.
Referenced by management_callback_send_cc_message(), multi_push_restart_schedule_exit(), process_explicit_exit_notification_init(), send_push_options(), send_push_reply(), send_push_request(), and send_restart().
bool send_control_channel_string_dowork | ( | struct tls_session * | session, |
const char * | str, | ||
int | msglevel | ||
) |
Definition at line 402 of file forward.c.
References ASSERT, gc_free(), gc_new(), session::key, KS_PRIMARY, msg, sanitize_control_message(), and tls_send_payload().
Referenced by send_auth_failed(), send_auth_pending_messages(), send_control_channel_string(), and send_push_reply_auth_token().
counter_type link_read_bytes_global |
Definition at line 49 of file forward.c.
Referenced by man_load_stats(), and process_incoming_link_part1().
counter_type link_write_bytes_global |
Definition at line 50 of file forward.c.
Referenced by man_load_stats(), and process_outgoing_link().