OpenVPN
Macros | Functions | Variables
forward.h File Reference

Interface functions to the internal and external multiplexers. More...

#include "openvpn.h"
#include "occ.h"
#include "ping.h"
#include "multi_io.h"
Include dependency graph for forward.h:
This graph shows which files directly or indirectly include this file:

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   (1u << 0)
 
#define PIP_MSSFIX   (1u << 1) /* v4 and v6 */
 
#define PIP_OUTGOING   (1u << 2)
 
#define PIPV4_EXTRACT_DHCP_ROUTER   (1u << 3)
 
#define PIPV4_CLIENT_NAT   (1u << 4)
 
#define PIPV6_ICMP_NOHOST_CLIENT   (1u << 5)
 
#define PIPV6_ICMP_NOHOST_SERVER   (1u << 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 extract_dco_float_peer_addr (sa_family_t socket_family, struct openvpn_sockaddr *out_osaddr, const struct sockaddr *float_sa)
 Transfers float_sa data extracted from an incoming DCO PEER_FLOAT_NTF to out_osaddr for later processing.
 
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_infoget_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
 

Detailed Description

Interface functions to the internal and external multiplexers.

Definition in file forward.h.

Macro Definition Documentation

◆ ANY_OUT

#define ANY_OUT (   c)    (TUN_OUT(c) || LINK_OUT(c))

Definition at line 39 of file forward.h.

◆ IOW_CHECK_RESIDUAL

#define IOW_CHECK_RESIDUAL   (1 << 5)

Definition at line 59 of file forward.h.

◆ IOW_FRAG

#define IOW_FRAG   (1 << 6)

Definition at line 60 of file forward.h.

◆ IOW_MBUF

#define IOW_MBUF   (1 << 7)

Definition at line 61 of file forward.h.

◆ IOW_READ

#define IOW_READ   (IOW_READ_TUN | IOW_READ_LINK)

Definition at line 65 of file forward.h.

◆ IOW_READ_LINK

#define IOW_READ_LINK   (1 << 3)

Definition at line 57 of file forward.h.

◆ IOW_READ_TUN

#define IOW_READ_TUN   (1 << 2)

Definition at line 56 of file forward.h.

◆ IOW_READ_TUN_FORCE

#define IOW_READ_TUN_FORCE   (1 << 8)

Definition at line 62 of file forward.h.

◆ IOW_SHAPER

#define IOW_SHAPER   (1 << 4)

Definition at line 58 of file forward.h.

◆ IOW_TO_LINK

#define IOW_TO_LINK   (1 << 1)

Definition at line 55 of file forward.h.

◆ IOW_TO_TUN

#define IOW_TO_TUN   (1 << 0)

Definition at line 54 of file forward.h.

◆ IOW_WAIT_SIGNAL

#define IOW_WAIT_SIGNAL   (1 << 9)

Definition at line 63 of file forward.h.

◆ LINK_OUT

#define LINK_OUT (   c)    (BLEN(&(c)->c2.to_link) > 0)

Definition at line 38 of file forward.h.

◆ PIP_MSSFIX

#define PIP_MSSFIX   (1u << 1) /* v4 and v6 */

Definition at line 318 of file forward.h.

◆ PIP_OUTGOING

#define PIP_OUTGOING   (1u << 2)

Definition at line 319 of file forward.h.

◆ PIPV4_CLIENT_NAT

#define PIPV4_CLIENT_NAT   (1u << 4)

Definition at line 321 of file forward.h.

◆ PIPV4_EXTRACT_DHCP_ROUTER

#define PIPV4_EXTRACT_DHCP_ROUTER   (1u << 3)

Definition at line 320 of file forward.h.

◆ PIPV4_PASSTOS

#define PIPV4_PASSTOS   (1u << 0)

Definition at line 317 of file forward.h.

◆ PIPV6_ICMP_NOHOST_CLIENT

#define PIPV6_ICMP_NOHOST_CLIENT   (1u << 5)

Definition at line 322 of file forward.h.

◆ PIPV6_ICMP_NOHOST_SERVER

#define PIPV6_ICMP_NOHOST_SERVER   (1u << 6)

Definition at line 323 of file forward.h.

◆ TO_LINK_DEF

#define TO_LINK_DEF (   c)    (LINK_OUT(c) || TO_LINK_FRAG(c))

Definition at line 47 of file forward.h.

◆ TO_LINK_FRAG

#define TO_LINK_FRAG (   c)    ((c)->c2.fragment && fragment_outgoing_defined((c)->c2.fragment))

Definition at line 42 of file forward.h.

◆ TUN_OUT

#define TUN_OUT (   c)    (BLEN(&(c)->c2.to_tun) > 0)

Definition at line 37 of file forward.h.

Function Documentation

◆ connection_established()

static bool connection_established ( struct context c)
inlinestatic

◆ extract_dco_float_peer_addr()

void extract_dco_float_peer_addr ( sa_family_t  socket_family,
struct openvpn_sockaddr out_osaddr,
const struct sockaddr *  float_sa 
)

Transfers float_sa data extracted from an incoming DCO PEER_FLOAT_NTF to out_osaddr for later processing.

Parameters
socket_family- The address family of the socket
out_osaddr- openvpn_sockaddr struct that will be filled the new address data
float_sa- The sockaddr struct containing the data received from the DCO notification

Definition at line 1221 of file forward.c.

References openvpn_sockaddr::addr, openvpn_sockaddr::in4, and openvpn_sockaddr::in6.

◆ get_io_flags_dowork_udp()

void get_io_flags_dowork_udp ( struct context c,
struct multi_io multi_io,
const unsigned int  flags 
)

Definition at line 2155 of file forward.c.

References multi_io::es, multi_io_process_flags(), and multi_io::udp_flags.

Referenced by get_io_flags_udp().

◆ get_io_flags_udp()

void get_io_flags_udp ( struct context c,
struct multi_io multi_io,
const unsigned int  flags 
)

◆ get_link_socket_info()

static struct link_socket_info * get_link_socket_info ( struct context c)
inlinestatic

◆ get_server_poll_remaining_time()

int get_server_poll_remaining_time ( struct event_timeout server_poll_timeout)

◆ io_wait()

static void io_wait ( struct context c,
const unsigned int  flags 
)
inlinestatic

◆ io_wait_dowork()

void io_wait_dowork ( struct context c,
const unsigned int  flags 
)

◆ p2p_iow_flags()

static unsigned int p2p_iow_flags ( const struct context c)
inlinestatic

◆ pre_select()

void pre_select ( struct context c)

◆ process_io()

void process_io ( struct context c,
struct link_socket sock 
)

◆ process_ip_header()

void process_ip_header ( struct context c,
unsigned int  flags,
struct buffer buf,
struct link_socket sock 
)

◆ register_activity()

static void register_activity ( struct context c,
const int  size 
)
inlinestatic

◆ reschedule_multi_process()

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 391 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().

◆ schedule_exit()

bool schedule_exit ( struct context c)

◆ send_control_channel_string()

bool send_control_channel_string ( struct context c,
const char *  str,
int  msglevel 
)

◆ send_control_channel_string_dowork()

bool send_control_channel_string_dowork ( struct tls_session session,
const char *  str,
int  msglevel 
)

Variable Documentation

◆ link_read_bytes_global

counter_type link_read_bytes_global
extern

Definition at line 49 of file forward.c.

Referenced by man_load_stats(), and process_incoming_link_part1().

◆ link_write_bytes_global

counter_type link_write_bytes_global
extern

Definition at line 50 of file forward.c.

Referenced by man_load_stats(), and process_outgoing_link().