OpenVPN
multi.h
Go to the documentation of this file.
1 /*
2  * OpenVPN -- An application to securely tunnel IP networks
3  * over a single TCP/UDP port, with support for SSL/TLS-based
4  * session authentication and key exchange,
5  * packet encryption, packet authentication, and
6  * packet compression.
7  *
8  * Copyright (C) 2002-2024 OpenVPN Inc <sales@openvpn.net>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License version 2
12  * as published by the Free Software Foundation.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program; if not, write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23 
28 #ifndef MULTI_H
29 #define MULTI_H
30 
31 #include "init.h"
32 #include "forward.h"
33 #include "mroute.h"
34 #include "mbuf.h"
35 #include "list.h"
36 #include "schedule.h"
37 #include "pool.h"
38 #include "mudp.h"
39 #include "mtcp.h"
40 #include "perf.h"
41 #include "vlan.h"
42 #include "reflect_filter.h"
43 
44 #define MULTI_PREFIX_MAX_LENGTH 256
45 
46 /*
47  * Walk (don't run) through the routing table,
48  * deleting old entries, and possibly multi_instance
49  * structs as well which have been marked for deletion.
50  */
51 struct multi_reap
52 {
55  time_t last_call;
56 };
57 
58 
60 {
63  struct timeval wakeup;
64 };
65 
71 {
72  /* Index of currently executed handler. */
74  /* Remember which option classes where processed for delayed option
75  * handling. */
76  unsigned int option_types_found;
77 
83 
88  char *config_file;
89 };
90 
102  struct schedule_entry se; /* this must be the first element of the structure,
103  * We cast between this and schedule_entry so the
104  * beginning of the struct must be identical */
105  struct gc_arena gc;
106  bool halt;
107  int refcount;
108  int route_count; /* number of routes (including cached routes) owned by this instance */
109  time_t created;
113  struct timeval wakeup; /* absolute time */
114  struct mroute_addr real;
118 
119  /* queued outgoing data in Server/TCP mode */
120  unsigned int tcp_rwflags;
123 
124  in_addr_t reporting_addr; /* IP address shown in status listing */
125  struct in6_addr reporting_addr_ipv6; /* IPv6 address in status listing */
126 
128  bool did_iter;
129 #ifdef ENABLE_MANAGEMENT
132 #endif
134  int n_clients_delta; /* added to multi_context.n_clients when instance is closed */
135 
136  struct context context;
139 #ifdef ENABLE_ASYNC_PUSH
140  int inotify_watch; /* watch descriptor for acf */
141 #endif
142 };
143 
144 
159  struct hash *hash;
161  struct hash *vhash;
163  struct hash *iter;
167  struct mbuf_set *mbuf;
170  struct multi_tcp *mtcp;
182  int n_clients; /* current number of authenticated clients */
183 
184 #ifdef ENABLE_MANAGEMENT
185  struct hash *cid_hash;
186  unsigned long cid_counter;
187 #endif
188 
194 
195  struct context top;
200 
201  /*
202  * Timer object for stale route check
203  */
205 
206 #ifdef ENABLE_ASYNC_PUSH
207  /* mapping between inotify watch descriptors and multi_instances */
208  struct hash *inotify_watchers;
209 #endif
210 
212 };
213 
218 {
223 };
224 
225 /*
226  * Host route
227  */
229 {
232 
233 #define MULTI_ROUTE_CACHE (1<<0)
234 #define MULTI_ROUTE_AGEABLE (1<<1)
235  unsigned int flags;
236 
237  unsigned int cache_generation;
239 };
240 
241 
242 /**************************************************************************/
254 void tunnel_server(struct context *top);
255 
256 
257 const char *multi_instance_string(const struct multi_instance *mi, bool null, struct gc_arena *gc);
258 
259 /*
260  * Called by mtcp.c, mudp.c, or other (to be written) protocol drivers
261  */
262 
263 void multi_init(struct multi_context *m, struct context *t, bool tcp_mode);
264 
265 void multi_uninit(struct multi_context *m);
266 
267 void multi_top_init(struct multi_context *m, struct context *top);
268 
269 void multi_top_free(struct multi_context *m);
270 
271 struct multi_instance *multi_create_instance(struct multi_context *m, const struct mroute_addr *real);
272 
273 void multi_close_instance(struct multi_context *m, struct multi_instance *mi, bool shutdown);
274 
275 bool multi_process_timeout(struct multi_context *m, const unsigned int mpp_flags);
276 
285 void multi_process_float(struct multi_context *m, struct multi_instance *mi);
286 
287 #define MPP_PRE_SELECT (1<<0)
288 #define MPP_CONDITIONAL_PRE_SELECT (1<<1)
289 #define MPP_CLOSE_ON_SIGNAL (1<<2)
290 #define MPP_RECORD_TOUCH (1<<3)
291 
292 
293 /**************************************************************************/
315 bool multi_process_post(struct multi_context *m, struct multi_instance *mi, const unsigned int flags);
316 
327 
328 /**************************************************************************/
351 bool multi_process_incoming_link(struct multi_context *m, struct multi_instance *instance, const unsigned int mpp_flags);
352 
353 
369 bool multi_process_incoming_tun(struct multi_context *m, const unsigned int mpp_flags);
370 
371 
372 void multi_process_drop_outgoing_tun(struct multi_context *m, const unsigned int mpp_flags);
373 
374 void multi_print_status(struct multi_context *m, struct status_output *so, const int version);
375 
376 struct multi_instance *multi_get_queue(struct mbuf_set *ms);
377 
378 void multi_add_mbuf(struct multi_context *m,
379  struct multi_instance *mi,
380  struct mbuf_buffer *mb);
381 
382 void multi_ifconfig_pool_persist(struct multi_context *m, bool force);
383 
384 bool multi_process_signal(struct multi_context *m);
385 
387 
389 
390 #ifdef ENABLE_ASYNC_PUSH
391 
398 void multi_process_file_closed(struct multi_context *m, const unsigned int mpp_flags);
399 
400 #endif
401 
402 /*
403  * Return true if our output queue is not full
404  */
405 static inline bool
407  const struct multi_instance *mi)
408 {
409  if (mi->tcp_link_out_deferred)
410  {
412  }
413  else
414  {
415  return true;
416  }
417 }
418 
419 /*
420  * Determine which instance has pending output
421  * and prepare the output for sending in
422  * the to_link buffer.
423  */
424 static inline struct multi_instance *
426 {
427  struct multi_instance *mi = NULL;
428 
429  if (m->pending)
430  {
431  mi = m->pending;
432  }
433  else if (mbuf_defined(m->mbuf))
434  {
435  mi = multi_get_queue(m->mbuf);
436  }
437  return mi;
438 }
439 
440 /*
441  * Per-client route quota management
442  */
443 
444 void route_quota_exceeded(const struct multi_instance *mi);
445 
446 static inline void
448 {
449  ++mi->route_count;
450 }
451 
452 static inline void
454 {
455  --mi->route_count;
456 }
457 
458 /* can we add a new route? */
459 static inline bool
461 {
463  {
465  return false;
466  }
467  else
468  {
469  return true;
470  }
471 }
472 
473 /*
474  * Instance reference counting
475  */
476 
477 static inline void
479 {
480  ++mi->refcount;
481 }
482 
483 static inline void
485 {
486  if (--mi->refcount <= 0)
487  {
488  gc_free(&mi->gc);
489  free(mi);
490  }
491 }
492 
493 static inline void
495 {
496  struct multi_instance *mi = route->instance;
497  route_quota_dec(mi);
499  free(route);
500 }
501 
502 static inline bool
504  const struct multi_route *r)
505 {
506  if (r->instance->halt)
507  {
508  return false;
509  }
510  else if ((r->flags & MULTI_ROUTE_CACHE)
512  {
513  return false;
514  }
515  else if ((r->flags & MULTI_ROUTE_AGEABLE)
517  {
518  return false;
519  }
520  else
521  {
522  return true;
523  }
524 }
525 
526 /*
527  * Takes prefix away from multi_instance.
528  */
529 void
531 
532 /*
533  * Set a msg() function prefix with our current client instance ID.
534  */
535 
536 static inline void
538 {
539 #ifdef MULTI_DEBUG_EVENT_LOOP
540  if (mi->msg_prefix[0])
541  {
542  printf("[%s]\n", mi->msg_prefix);
543  }
544 #endif
545  msg_set_prefix(mi->msg_prefix[0] ? mi->msg_prefix : NULL);
546 }
547 
548 static inline void
550 {
551 #ifdef MULTI_DEBUG_EVENT_LOOP
552  printf("[NULL]\n");
553 #endif
554  msg_set_prefix(NULL);
555 }
556 
557 /*
558  * Instance Reaper
559  *
560  * Reaper constants. The reaper is the process where the virtual address
561  * and virtual route hash table is scanned for dead entries which are
562  * then removed. The hash table could potentially be quite large, so we
563  * don't want to reap in a single pass.
564  */
565 
566 #define REAP_MAX_WAKEUP 10 /* Do reap pass at least once per n seconds */
567 #define REAP_DIVISOR 256 /* How many passes to cover whole hash table */
568 #define REAP_MIN 16 /* Minimum number of buckets per pass */
569 #define REAP_MAX 1024 /* Maximum number of buckets per pass */
570 
571 /*
572  * Mark a cached host route for deletion after this
573  * many seconds without any references.
574  */
575 #define MULTI_CACHE_ROUTE_TTL 60
576 
577 void multi_reap_process_dowork(const struct multi_context *m);
578 
580 
581 static inline void
583 {
584  if (m->reaper->last_call != now)
585  {
587  }
588 }
589 
590 static inline void
592 {
593  if (m->per_second_trigger != now)
594  {
596  m->per_second_trigger = now;
597  }
598 }
599 
600 /*
601  * Compute earliest timeout expiry from the set of
602  * all instances. Output:
603  *
604  * m->earliest_wakeup : instance needing the earliest service.
605  * dest : earliest timeout as a delta in relation
606  * to current time.
607  */
608 static inline void
609 multi_get_timeout(struct multi_context *m, struct timeval *dest)
610 {
611  struct timeval tv, current;
612 
613  CLEAR(tv);
615  if (m->earliest_wakeup)
616  {
617  ASSERT(!openvpn_gettimeofday(&current, NULL));
618  tv_delta(dest, &current, &tv);
619  if (dest->tv_sec >= REAP_MAX_WAKEUP)
620  {
621  m->earliest_wakeup = NULL;
622  dest->tv_sec = REAP_MAX_WAKEUP;
623  dest->tv_usec = 0;
624  }
625  }
626  else
627  {
628  dest->tv_sec = REAP_MAX_WAKEUP;
629  dest->tv_usec = 0;
630  }
631 }
632 
633 
651 static inline bool
652 multi_process_outgoing_tun(struct multi_context *m, const unsigned int mpp_flags)
653 {
654  struct multi_instance *mi = m->pending;
655  bool ret = true;
656 
657  ASSERT(mi);
658 #ifdef MULTI_DEBUG_EVENT_LOOP
659  printf("%s -> TUN len=%d\n",
660  id(mi),
661  mi->context.c2.to_tun.len);
662 #endif
663  set_prefix(mi);
666  ret = multi_process_post(m, mi, mpp_flags);
667  clear_prefix();
668  return ret;
669 }
670 
671 #define CLIENT_CONNECT_OPT_MASK (OPT_P_INSTANCE | OPT_P_INHERIT \
672  |OPT_P_PUSH | OPT_P_TIMER | OPT_P_CONFIG \
673  |OPT_P_ECHO | OPT_P_COMP | OPT_P_SOCKFLAGS)
674 
675 static inline bool
676 multi_process_outgoing_link_dowork(struct multi_context *m, struct multi_instance *mi, const unsigned int mpp_flags)
677 {
678  bool ret = true;
679  set_prefix(mi);
681  ret = multi_process_post(m, mi, mpp_flags);
682  clear_prefix();
683  return ret;
684 }
685 
686 /*
687  * Check for signals.
688  */
689 #define MULTI_CHECK_SIG(m) EVENT_LOOP_CHECK_SIGNAL(&(m)->top, multi_process_signal, (m))
690 
691 static inline void
693 {
694  m->pending = mi;
695 }
704 void multi_assign_peer_id(struct multi_context *m, struct multi_instance *mi);
705 
706 
707 #endif /* MULTI_H */
multi_reap::buckets_per_pass
int buckets_per_pass
Definition: multi.h:54
multi_context::n_clients
int n_clients
Definition: multi.h:182
multi_instance
Server-mode state structure for one single VPN tunnel.
Definition: multi.h:101
multi_instance::halt
bool halt
Definition: multi.h:106
reflect_filter.h
multi_process_incoming_dco
bool multi_process_incoming_dco(struct multi_context *m)
Process an incoming DCO message (from kernel space).
ifconfig_pool_handle
int ifconfig_pool_handle
Definition: pool.h:71
multi_uninit
void multi_uninit(struct multi_context *m)
Definition: multi.c:705
mbuf_defined
static bool mbuf_defined(const struct mbuf_set *ms)
Definition: mbuf.h:80
route_quota_exceeded
void route_quota_exceeded(const struct multi_instance *mi)
Definition: multi.c:3729
multi_process_per_second_timers_dowork
void multi_process_per_second_timers_dowork(struct multi_context *m)
Definition: multi.c:3787
multi_context::route_helper
struct mroute_helper * route_helper
Definition: multi.h:175
CC_RET_FAILED
@ CC_RET_FAILED
Definition: multi.h:219
route_quota_test
static bool route_quota_test(const struct multi_instance *mi)
Definition: multi.h:460
multi_instance::tcp_rwflags
unsigned int tcp_rwflags
Definition: multi.h:120
multi_context::stale_routes_check_et
struct event_timeout stale_routes_check_et
Definition: multi.h:204
deferred_signal_schedule_entry::se
struct schedule_entry se
Definition: multi.h:61
tv_delta
static void tv_delta(struct timeval *dest, const struct timeval *t1, const struct timeval *t2)
Definition: otime.h:220
multi_context::reaper
struct multi_reap * reaper
Definition: multi.h:176
forward.h
multi_instance::reporting_addr
in_addr_t reporting_addr
Definition: multi.h:124
CC_RET_SUCCEEDED
@ CC_RET_SUCCEEDED
Definition: multi.h:220
buffer::len
int len
Length in bytes of the actual content within the allocated memory.
Definition: buffer.h:66
multi_process_signal
bool multi_process_signal(struct multi_context *m)
Definition: multi.c:3876
multi_context::tcp_queue_limit
int tcp_queue_limit
Definition: multi.h:180
MULTI_ROUTE_AGEABLE
#define MULTI_ROUTE_AGEABLE
Definition: multi.h:234
initial_packet_rate_limit
struct that handles all the rate limiting logic for initial responses
Definition: reflect_filter.h:30
multi_top_init
void multi_top_init(struct multi_context *m, struct context *top)
Definition: multi.c:3816
schedule.h
context
Contains all state information for one tunnel.
Definition: openvpn.h:476
hash
Definition: list.h:56
deferred_signal_schedule_entry::wakeup
struct timeval wakeup
Definition: multi.h:63
mbuf_set
Definition: mbuf.h:56
multi_context::mbuf
struct mbuf_set * mbuf
Set of buffers for passing data channel packets between VPN tunnel instances.
Definition: multi.h:167
multi_instance::real
struct mroute_addr real
External network address of the remote peer.
Definition: multi.h:114
multi_instance::gc
struct gc_arena gc
Definition: multi.h:105
REAP_MAX_WAKEUP
#define REAP_MAX_WAKEUP
Definition: multi.h:566
set_prefix
static void set_prefix(struct multi_instance *mi)
Definition: multi.h:537
client_connect_defer_state::deferred_ret_file
char * deferred_ret_file
The temporary file name that contains the return status of the client-connect script if it exits with...
Definition: multi.h:82
multi_instance::wakeup
struct timeval wakeup
Definition: multi.h:113
multi_process_float
void multi_process_float(struct multi_context *m, struct multi_instance *mi)
Handles peer floating.
Definition: multi.c:3138
multi_tcp
Definition: mtcp.h:36
schedule_get_earliest_wakeup
static struct schedule_entry * schedule_get_earliest_wakeup(struct schedule *s, struct timeval *wakeup)
Definition: schedule.h:118
vlan.h
multi_close_instance_on_signal
void multi_close_instance_on_signal(struct multi_context *m, struct multi_instance *mi)
Definition: multi.c:3215
multi_ifconfig_pool_persist
void multi_ifconfig_pool_persist(struct multi_context *m, bool force)
Definition: multi.c:163
multi_instance::se
struct schedule_entry se
Definition: multi.h:102
schedule
Definition: schedule.h:53
multi_instance::route_count
int route_count
Definition: multi.h:108
multi_context::per_second_trigger
time_t per_second_trigger
Definition: multi.h:193
multi_init
void multi_init(struct multi_context *m, struct context *t, bool tcp_mode)
Definition: multi.c:292
client_connect_defer_state::config_file
char * config_file
The temporary file name that contains the config directives returned by the client-connect script.
Definition: multi.h:88
multi_context::schedule
struct schedule * schedule
Definition: multi.h:166
ifconfig_pool
Definition: pool.h:49
client_connect_defer_state
Detached client connection state.
Definition: multi.h:70
multi_route::addr
struct mroute_addr addr
Definition: multi.h:230
multi_route::last_reference
time_t last_reference
Definition: multi.h:238
multi_reap::last_call
time_t last_call
Definition: multi.h:55
multi_context::enable_c2c
bool enable_c2c
Definition: multi.h:178
multi_route::instance
struct multi_instance * instance
Definition: multi.h:231
multi_context::max_clients
int max_clients
Definition: multi.h:179
multi_context::new_connection_limiter
struct frequency_limit * new_connection_limiter
Definition: multi.h:173
process_outgoing_tun
void process_outgoing_tun(struct context *c)
Write a packet to the virtual tun/tap network interface.
Definition: forward.c:1907
multi_process_post
bool multi_process_post(struct multi_context *m, struct multi_instance *mi, const unsigned int flags)
Perform postprocessing of a VPN tunnel instance.
Definition: multi.c:3041
CLEAR
#define CLEAR(x)
Definition: basic.h:33
multi_context::cid_counter
unsigned long cid_counter
Definition: multi.h:186
multi_context::deferred_shutdown_signal
struct deferred_signal_schedule_entry deferred_shutdown_signal
Definition: multi.h:211
clear_prefix
static void clear_prefix(void)
Definition: multi.h:549
multi_instance_dec_refcount
static void multi_instance_dec_refcount(struct multi_instance *mi)
Definition: multi.h:484
context::c2
struct context_2 c2
Level 2 context.
Definition: openvpn.h:517
multi_context::instances
struct multi_instance ** instances
Array of multi_instances.
Definition: multi.h:156
ASSERT
#define ASSERT(x)
Definition: error.h:195
route_quota_inc
static void route_quota_inc(struct multi_instance *mi)
Definition: multi.h:447
multi_instance::cc_config
struct buffer_list * cc_config
Definition: multi.h:131
multi_context::top
struct context top
Storage structure for process-wide configuration.
Definition: multi.h:195
multi_instance::socket_set_called
bool socket_set_called
Definition: multi.h:122
ungenerate_prefix
void ungenerate_prefix(struct multi_instance *mi)
Definition: multi.c:513
multi_context::status_file_version
int status_file_version
Definition: multi.h:181
multi_context::local
struct mroute_addr local
Definition: multi.h:177
multi_add_mbuf
void multi_add_mbuf(struct multi_context *m, struct multi_instance *mi, struct mbuf_buffer *mb)
Definition: multi.c:2881
tunnel_server
void tunnel_server(struct context *top)
Main event loop for OpenVPN in server mode.
Definition: multi.c:4169
context_buffers
Definition: openvpn.h:94
init.h
multi_process_outgoing_link_dowork
static bool multi_process_outgoing_link_dowork(struct multi_context *m, struct multi_instance *mi, const unsigned int mpp_flags)
Definition: multi.h:676
multi_context::cid_hash
struct hash * cid_hash
Definition: multi.h:185
vlan_process_outgoing_tun
void vlan_process_outgoing_tun(struct multi_context *m, struct multi_instance *mi)
Definition: vlan.c:296
multi_instance_inc_refcount
static void multi_instance_inc_refcount(struct multi_instance *mi)
Definition: multi.h:478
mbuf.h
context::options
struct options options
Options loaded from command line or configuration file.
Definition: openvpn.h:478
multi_context::mpp_touched
struct multi_instance ** mpp_touched
Definition: multi.h:191
pool.h
mroute_helper::cache_generation
unsigned int cache_generation
Definition: mroute.h:132
multi_context::hash
struct hash * hash
VPN tunnel instances indexed by real address of the remote peer.
Definition: multi.h:159
multi_instance::reporting_addr_ipv6
struct in6_addr reporting_addr_ipv6
Definition: multi.h:125
multi_process_per_second_timers
static void multi_process_per_second_timers(struct multi_context *m)
Definition: multi.h:591
status_output
Definition: status.h:48
frequency_limit
Definition: otime.h:31
multi_instance::did_cid_hash
bool did_cid_hash
Definition: multi.h:130
multi_reap
Definition: multi.h:51
multi_context::pending
struct multi_instance * pending
Definition: multi.h:189
msg_set_prefix
static void msg_set_prefix(const char *prefix)
Definition: error.h:305
multi_context::vhash
struct hash * vhash
VPN tunnel instances indexed by virtual address of remote hosts.
Definition: multi.h:161
multi_process_timeout
bool multi_process_timeout(struct multi_context *m, const unsigned int mpp_flags)
Definition: multi.c:3676
buffer
Wrapper structure for dynamically allocated memory.
Definition: buffer.h:60
deferred_signal_schedule_entry::signal_received
int signal_received
Definition: multi.h:62
init_management_callback_multi
void init_management_callback_multi(struct multi_context *m)
Definition: multi.c:4119
multi_context::earliest_wakeup
struct multi_instance * earliest_wakeup
Definition: multi.h:190
multi_instance::vaddr_handle
ifconfig_pool_handle vaddr_handle
Definition: multi.h:116
multi_context::hmac_reply
struct buffer hmac_reply
Definition: multi.h:198
multi_route::flags
unsigned int flags
Definition: multi.h:235
route_quota_dec
static void route_quota_dec(struct multi_instance *mi)
Definition: multi.h:453
multi_instance::msg_prefix
char msg_prefix[MULTI_PREFIX_MAX_LENGTH]
Definition: multi.h:117
multi_set_pending
static void multi_set_pending(struct multi_context *m, struct multi_instance *mi)
Definition: multi.h:692
multi_create_instance
struct multi_instance * multi_create_instance(struct multi_context *m, const struct mroute_addr *real)
Definition: multi.c:753
mroute_addr
Definition: mroute.h:75
mroute_helper::ageable_ttl_secs
int ageable_ttl_secs
Definition: mroute.h:133
multi_process_incoming_tun
bool multi_process_incoming_tun(struct multi_context *m, const unsigned int mpp_flags)
Determine the destination VPN tunnel of a packet received over the virtual tun/tap network interface ...
Definition: multi.c:3547
multi_assign_peer_id
void multi_assign_peer_id(struct multi_context *m, struct multi_instance *mi)
Assigns a peer-id to a a client and adds the instance to the the instances array of the multi_context...
Definition: multi.c:4144
schedule_entry
Definition: schedule.h:44
gc_arena
Garbage collection arena used to keep track of dynamically allocated memory.
Definition: buffer.h:116
multi_close_instance
void multi_close_instance(struct multi_context *m, struct multi_instance *mi, bool shutdown)
Definition: multi.c:602
mbuf_buffer
Definition: mbuf.h:41
route
@ route
Definition: interactive.c:87
multi_route
Definition: multi.h:228
multi_instance::did_iter
bool did_iter
Definition: multi.h:128
mroute.h
multi_context
Main OpenVPN server state structure.
Definition: multi.h:155
deferred_signal_schedule_entry
Definition: multi.h:59
perf.h
multi_output_queue_ready
static bool multi_output_queue_ready(const struct multi_context *m, const struct multi_instance *mi)
Definition: multi.h:406
multi_process_drop_outgoing_tun
void multi_process_drop_outgoing_tun(struct multi_context *m, const unsigned int mpp_flags)
Definition: multi.c:3707
client_connect_defer_state::cur_handler_index
int cur_handler_index
Definition: multi.h:73
client_connect_return
client_connect_return
Return values used by the client connect call-back functions.
Definition: multi.h:217
multi_context::hmac_reply_dest
struct link_socket_actual * hmac_reply_dest
Definition: multi.h:199
context_2::to_tun
struct buffer to_tun
Definition: openvpn.h:379
multi_context::context_buffers
struct context_buffers * context_buffers
Definition: multi.h:192
multi_context::iter
struct hash * iter
VPN tunnel instances indexed by real address of the remote peer, optimized for iteration.
Definition: multi.h:163
client_connect_defer_state::option_types_found
unsigned int option_types_found
Definition: multi.h:76
multi_instance_string
const char * multi_instance_string(const struct multi_instance *mi, bool null, struct gc_arena *gc)
Definition: multi.c:465
multi_get_queue
struct multi_instance * multi_get_queue(struct mbuf_set *ms)
Definition: multi.c:3642
mtcp.h
openvpn_gettimeofday
static int openvpn_gettimeofday(struct timeval *tv, void *tz)
Definition: otime.h:64
mbuf_len
static unsigned int mbuf_len(const struct mbuf_set *ms)
Definition: mbuf.h:86
mroute_helper
Definition: mroute.h:131
gc_free
static void gc_free(struct gc_arena *a)
Definition: buffer.h:1038
CC_RET_SKIPPED
@ CC_RET_SKIPPED
Definition: multi.h:222
multi_route::cache_generation
unsigned int cache_generation
Definition: multi.h:237
multi_route_defined
static bool multi_route_defined(const struct multi_context *m, const struct multi_route *r)
Definition: multi.h:503
options::max_routes_per_client
int max_routes_per_client
Definition: options.h:519
multi_reap::bucket_base
int bucket_base
Definition: multi.h:53
mudp.h
MULTI_ROUTE_CACHE
#define MULTI_ROUTE_CACHE
Definition: multi.h:233
now
time_t now
Definition: otime.c:34
multi_instance::did_iroutes
bool did_iroutes
Definition: multi.h:133
multi_instance::created
time_t created
Time at which a VPN tunnel instance was created.
Definition: multi.h:109
multi_route_del
static void multi_route_del(struct multi_route *route)
Definition: multi.h:494
multi_process_incoming_link
bool multi_process_incoming_link(struct multi_context *m, struct multi_instance *instance, const unsigned int mpp_flags)
Demultiplex and process a packet received over the external network interface.
Definition: multi.c:3343
multi_context::initial_rate_limiter
struct initial_packet_rate_limit * initial_rate_limiter
Definition: multi.h:174
event_timeout
Definition: interval.h:136
multi_context::mtcp
struct multi_tcp * mtcp
State specific to OpenVPN using TCP as external transport.
Definition: multi.h:170
multi_process_outgoing_tun
static bool multi_process_outgoing_tun(struct multi_context *m, const unsigned int mpp_flags)
Send a packet over the virtual tun/tap network interface to its locally reachable destination.
Definition: multi.h:652
multi_instance::tcp_link_out_deferred
struct mbuf_set * tcp_link_out_deferred
Definition: multi.h:121
list.h
CC_RET_DEFERRED
@ CC_RET_DEFERRED
Definition: multi.h:221
MULTI_PREFIX_MAX_LENGTH
#define MULTI_PREFIX_MAX_LENGTH
Definition: multi.h:44
multi_print_status
void multi_print_status(struct multi_context *m, struct status_output *so, const int version)
Definition: multi.c:843
multi_context::ifconfig_pool
struct ifconfig_pool * ifconfig_pool
Definition: multi.h:172
buffer_list
Definition: buffer.h:1125
multi_instance::did_real_hash
bool did_real_hash
Definition: multi.h:127
process_outgoing_link
void process_outgoing_link(struct context *c)
Write a packet to the external network interface.
Definition: forward.c:1752
multi_instance::context
struct context context
The context structure storing state for this VPN tunnel.
Definition: multi.h:136
multi_reap_process_dowork
void multi_reap_process_dowork(const struct multi_context *m)
Definition: multi.c:225
multi_get_timeout
static void multi_get_timeout(struct multi_context *m, struct timeval *dest)
Definition: multi.h:609
multi_instance::n_clients_delta
int n_clients_delta
Definition: multi.h:134
multi_top_free
void multi_top_free(struct multi_context *m)
Definition: multi.c:3823
multi_instance::refcount
int refcount
Definition: multi.h:107
multi_process_outgoing_link_pre
static struct multi_instance * multi_process_outgoing_link_pre(struct multi_context *m)
Definition: multi.h:425
multi_reap_process
static void multi_reap_process(const struct multi_context *m)
Definition: multi.h:582