OpenVPN
|
Interface functions to the internal and external multiplexers. More...
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 | get_io_flags_dowork_udp (struct context *c, struct multi_io *multi_io, const unsigned int flags) |
void | get_io_flags_udp (struct context *c, struct multi_io *multi_io, const unsigned int flags) |
void | io_wait_dowork (struct context *c, const unsigned int flags) |
void | pre_select (struct context *c) |
void | process_io (struct context *c, struct link_socket *sock) |
void | encrypt_sign (struct context *c, bool comp_frag) |
Process a data channel packet that will be sent through a VPN tunnel. | |
int | get_server_poll_remaining_time (struct event_timeout *server_poll_timeout) |
void | read_incoming_link (struct context *c, struct link_socket *sock) |
Read a packet from the external network interface. | |
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_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. | |
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. | |
void | process_ip_header (struct context *c, unsigned int flags, struct buffer *buf, struct link_socket *sock) |
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 430 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().
void get_io_flags_dowork_udp | ( | struct context * | c, |
struct multi_io * | multi_io, | ||
const unsigned int | flags | ||
) |
Definition at line 2192 of file forward.c.
References multi_io::es, multi_io_process_flags(), and multi_io::udp_flags.
Referenced by get_io_flags_udp().
Definition at line 2201 of file forward.c.
References context::c1, context::c2, ES_ERROR, context_2::fast_io, get_io_flags_dowork_udp(), IOW_MBUF, IOW_READ_TUN, IOW_TO_LINK, IOW_TO_TUN, SOCKET_WRITE, TUN_READ, TUN_WRITE, context_1::tuntap, tuntap_is_wintun(), and multi_io::udp_flags.
Referenced by multi_io_wait().
|
inlinestatic |
Definition at line 321 of file forward.h.
References context::c2, link_socket::info, context_2::link_socket_infos, and context_2::link_sockets.
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(), initialization_sequence_completed(), multi_client_connect_setenv(), multi_client_disconnect_setenv(), and multi_client_generate_tls_keys().
int get_server_poll_remaining_time | ( | struct event_timeout * | server_poll_timeout | ) |
Definition at line 509 of file forward.c.
References event_timeout_remaining(), max_int(), and update_time().
Referenced by dco_p2p_new_peer(), establish_http_proxy_passthru(), phase2_socks_client(), phase2_tcp_client(), recv_socks_reply(), socks_handshake(), and socks_username_password_auth().
|
inlinestatic |
Definition at line 377 of file forward.h.
References context::c1, context::c2, context_2::event_set_status, context_2::fast_io, link_socket::info, io_wait_dowork(), IOW_MBUF, IOW_READ_TUN, IOW_TO_LINK, IOW_TO_TUN, context_2::link_sockets, link_socket_info::proto, proto_is_dgram(), SOCKET_WRITE, TUN_READ, TUN_WRITE, context_1::tuntap, and tuntap_is_wintun().
Referenced by multi_io_wait_lite(), and tunnel_point_to_point().
void io_wait_dowork | ( | struct context * | c, |
const unsigned int | flags | ||
) |
Definition at line 2254 of file forward.c.
References event_set_return::arg, context::c1, context::c2, check_debug_level(), check_status(), D_EVENT_WAIT, D_LINK_ERRORS, tuntap::dco, dco_event_set(), DCO_SHIFT, context_2::did_open_tun, dmsg, ES_ERROR, ES_TIMEOUT, EVENT_ARG_LINK_SOCKET, event_ctl(), EVENT_READ, event_reset(), context_2::event_set, context_2::event_set_status, event_wait(), FILE_SHIFT, get_signal(), IOW_CHECK_RESIDUAL, MANAGEMENT_SHIFT, management_socket_set(), options::mode, MODE_SERVER, msg, multi_io_process_flags(), MULTI_N, context::options, event_set_return::rwflags, context::sig, signal_info::signal_received, SIZE, SOCKET_READ, SOCKET_SHIFT, sockets_read_residual(), status, context_2::timeval, context_1::tuntap, event_arg::type, and update_time().
Referenced by io_wait().
|
inlinestatic |
Definition at line 352 of file forward.h.
References context::c1, context::c2, IOW_CHECK_RESIDUAL, IOW_FRAG, IOW_READ, 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, |
struct link_socket * | sock | ||
) |
Definition at line 2387 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(), event_arg::sock, SOCKET_READ, SOCKET_WRITE, status, TUN_READ, and TUN_WRITE.
Referenced by tunnel_point_to_point().
void process_ip_header | ( | struct context * | c, |
unsigned int | flags, | ||
struct buffer * | buf, | ||
struct link_socket * | sock | ||
) |
Definition at line 1658 of file forward.c.
References options::block_ipv6, options::ce, options::client_nat, client_nat_transform(), CN_INCOMING, CN_OUTGOING, dhcp_extract_router_msg(), ipv6_send_icmp_unreachable(), is_ipv4(), is_ipv6(), buffer::len, 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, route_list_add_vpn_gateway(), and TUNNEL_TYPE.
Referenced by multi_get_queue(), process_incoming_tun(), and process_outgoing_tun().
|
inlinestatic |
Definition at line 334 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 403 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 533 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 410 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 381 of file forward.c.
References ASSERT, gc, 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().
|
extern |
Definition at line 50 of file forward.c.
Referenced by man_load_stats(), and process_incoming_link_part1().
|
extern |
Definition at line 51 of file forward.c.
Referenced by man_load_stats(), and process_outgoing_link().