OpenVPN
Functions
mudp.c File Reference
#include "syshead.h"
#include "multi.h"
#include <inttypes.h>
#include "forward.h"
#include "memdbg.h"
#include "ssl_pkt.h"
Include dependency graph for mudp.c:

Go to the source code of this file.

Functions

static void send_standalone_reply (struct multi_context *m, struct buffer *buf, const char *prefix, const char *detail, struct link_socket *sock)
 Send an already-built standalone control packet back to the peer that just contacted us (c2.from), synchronously and without keeping any state.
 
static void send_hmac_reset_packet (struct multi_context *m, struct tls_pre_decrypt_state *state, struct tls_auth_standalone *tas, struct session_id *sid, bool request_resend_wkc, struct link_socket *sock)
 
static bool do_pre_decrypt_check (struct multi_context *m, struct tls_pre_decrypt_state *state, struct mroute_addr addr, struct link_socket *sock)
 
static struct multi_instancehandle_connection_attempt (struct multi_context *m, struct link_socket *sock, struct mroute_addr *real)
 Handles a packet if no existing session exists for this incoming packet.
 
static struct multi_instancemulti_get_instance_udp_real (struct multi_context *m, struct mroute_addr *real)
 Looks up an multi instance by its real address (IP and port)
 
struct multi_instancemulti_get_instance_udp_control (struct multi_context *m, struct link_socket *sock)
 
struct multi_instancemulti_get_instance_udp_data (struct multi_context *m, bool *floated, struct mroute_addr *real, struct link_socket *sock)
 Get a client instance based on real address.
 
struct multi_instancemulti_get_create_instance_udp (struct multi_context *m, bool *floated, struct link_socket *sock)
 Get, and if necessary create, the multi_instance associated with a packet's source address.
 
static void multi_process_outgoing_link (struct multi_context *m, const unsigned int mpp_flags)
 
void multi_process_io_udp (struct multi_context *m, struct link_socket *sock, unsigned int rwflags)
 

Function Documentation

◆ do_pre_decrypt_check()

static bool do_pre_decrypt_check ( struct multi_context m,
struct tls_pre_decrypt_state state,
struct mroute_addr  addr,
struct link_socket sock 
)
static

◆ handle_connection_attempt()

static struct multi_instance * handle_connection_attempt ( struct multi_context m,
struct link_socket sock,
struct mroute_addr real 
)
static

◆ multi_get_instance_udp_control()

struct multi_instance * multi_get_instance_udp_control ( struct multi_context m,
struct link_socket sock 
)

◆ multi_get_instance_udp_data()

struct multi_instance * multi_get_instance_udp_data ( struct multi_context m,
bool *  floated,
struct mroute_addr real,
struct link_socket sock 
)

◆ multi_get_instance_udp_real()

static struct multi_instance * multi_get_instance_udp_real ( struct multi_context m,
struct mroute_addr real 
)
static

Looks up an multi instance by its real address (IP and port)

Parameters
mmulti context
realAddress to look up
Returns
instance matching the address, NULL otherwise

Definition at line 289 of file mudp.c.

References multi_context::hash, hash_lookup_fast(), hash_value(), and hash_element::value.

Referenced by multi_get_instance_udp_control(), and multi_get_instance_udp_data().

◆ multi_process_io_udp()

void multi_process_io_udp ( struct multi_context m,
struct link_socket sock,
unsigned int  rwflags 
)

◆ multi_process_outgoing_link()

static void multi_process_outgoing_link ( struct multi_context m,
const unsigned int  mpp_flags 
)
inlinestatic

◆ send_hmac_reset_packet()

static void send_hmac_reset_packet ( struct multi_context m,
struct tls_pre_decrypt_state state,
struct tls_auth_standalone tas,
struct session_id sid,
bool  request_resend_wkc,
struct link_socket sock 
)
static

◆ send_standalone_reply()

static void send_standalone_reply ( struct multi_context m,
struct buffer buf,
const char *  prefix,
const char *  detail,
struct link_socket sock 
)
static

Send an already-built standalone control packet back to the peer that just contacted us (c2.from), synchronously and without keeping any state.

We do not want to keep state for a reply to an initial/out-of-band packet, so we send it without queueing. If we hit EAGAIN on a busy socket the packet is lost and the client simply retries – an acceptable compromise that avoids consuming server resources under attack.

Parameters
mthe server's multi_context
bufthe packet to send (built by a tls_*_standalone() helper)
prefixmsg() prefix to set for the duration of the send
detailD_MULTI_DEBUG message describing the reply
sockthe socket to send the reply on

Definition at line 56 of file mudp.c.

References ASSERT, context_buffers::aux_buf, buf_copy(), buf_init, context_2::buffers, context::c2, D_MULTI_DEBUG, context_2::from, buffer::len, msg, msg_set_prefix(), buffer::offset, process_outgoing_link(), context_2::to_link, context_2::to_link_addr, and multi_context::top.

Referenced by send_hmac_reset_packet().