OpenVPN
dco.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) 2021-2024 Arne Schwabe <arne@rfc2549.org>
9 * Copyright (C) 2021-2024 Antonio Quartulli <a@unstable.cc>
10 * Copyright (C) 2021-2024 OpenVPN Inc <sales@openvpn.net>
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2
14 * as published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program (see the file COPYING included with this
23 * distribution); if not, write to the Free Software Foundation, Inc.,
24 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 */
26#ifndef DCO_H
27#define DCO_H
28
29#include "buffer.h"
30#include "error.h"
31#include "dco_internal.h"
32#include "networking.h"
33
34/* forward declarations (including other headers leads to nasty include
35 * order problems)
36 */
37struct event_set;
38struct key2;
39struct key_state;
40struct multi_context;
41struct multi_instance;
42struct mroute_addr;
43struct options;
44struct tls_multi;
45struct tuntap;
46
47#define DCO_IROUTE_METRIC 100
48#define DCO_DEFAULT_METRIC 200
49
50#if defined(ENABLE_DCO)
51
59bool dco_available(int msglevel);
60
61
68const char *dco_version_string(struct gc_arena *gc);
69
79bool dco_check_option(int msglevel, const struct options *o);
80
91bool dco_check_startup_option(int msglevel, const struct options *o);
92
102bool dco_check_pull_options(int msglevel, const struct options *o);
103
112bool ovpn_dco_init(int mode, dco_context_t *dco, const char *dev_node);
113
122int open_tun_dco(struct tuntap *tt, openvpn_net_ctx_t *ctx, const char *dev);
123
130void close_tun_dco(struct tuntap *tt, openvpn_net_ctx_t *ctx);
131
139
143void dco_event_set(dco_context_t *dco, struct event_set *es, void *arg);
144
159int init_key_dco_bi(struct tls_multi *multi, struct key_state *ks,
160 const struct key2 *key2, int key_direction,
161 const char *ciphername, bool server);
162
172bool dco_update_keys(dco_context_t *dco, struct tls_multi *multi);
179int dco_p2p_add_new_peer(struct context *c);
180
193int dco_set_peer(dco_context_t *dco, unsigned int peerid,
194 int keepalive_interval, int keepalive_timeout, int mss);
195
201void dco_remove_peer(struct context *c);
202
210int dco_multi_add_new_peer(struct multi_context *m, struct multi_instance *mi);
211
220void dco_install_iroute(struct multi_context *m, struct multi_instance *mi,
221 struct mroute_addr *addr);
222
229void dco_delete_iroutes(struct multi_context *m, struct multi_instance *mi);
230
239 const bool raise_sigusr1_on_err);
240
247int dco_get_peer_stats(struct context *c, const bool raise_sigusr1_on_err);
248
254const char *dco_get_supported_ciphers(void);
255
260static inline bool
262{
263 return false;
264}
265#else /* if defined(ENABLE_DCO) */
266
267typedef void *dco_context_t;
268
269static inline bool
270dco_available(int msglevel)
271{
272 return false;
273}
274
275static inline const char *
277{
278 return "not-compiled";
279}
280
281static inline bool
282dco_check_option(int msglevel, const struct options *o)
283{
284 return false;
285}
286
287static inline bool
288dco_check_startup_option(int msglevel, const struct options *o)
289{
290 return false;
291}
292
293static inline bool
294dco_check_pull_options(int msglevel, const struct options *o)
295{
296 return false;
297}
298
299static inline bool
300ovpn_dco_init(int mode, dco_context_t *dco, const char *dev_node)
301{
302 return true;
303}
304
305static inline int
306open_tun_dco(struct tuntap *tt, openvpn_net_ctx_t *ctx, const char *dev)
307{
308 return 0;
309}
310
311static inline void
313{
314}
315
316static inline int
318{
319 ASSERT(false);
320 return 0;
321}
322
323static inline void
325{
326}
327
328static inline int
329init_key_dco_bi(struct tls_multi *multi, struct key_state *ks,
330 const struct key2 *key2, int key_direction,
331 const char *ciphername, bool server)
332{
333 return 0;
334}
335
336static inline bool
338{
339 ASSERT(false);
340 return false;
341}
342
343static inline int
345{
346 return 0;
347}
348
349static inline int
350dco_set_peer(dco_context_t *dco, unsigned int peerid,
351 int keepalive_interval, int keepalive_timeout, int mss)
352{
353 return 0;
354}
355
356static inline void
358{
359}
360
361static inline int
363{
364 return 0;
365}
366
367static inline void
369 struct mroute_addr *addr)
370{
371}
372
373static inline void
375{
376}
377
378static inline int
380 const bool raise_sigusr1_on_err)
381{
382 return 0;
383}
384
385static inline int
386dco_get_peer_stats(struct context *c, const bool raise_sigusr1_on_err)
387{
388 return 0;
389}
390
391static inline const char *
393{
394 return "";
395}
396
397static inline bool
399{
400 return false;
401}
402#endif /* defined(ENABLE_DCO) */
403#endif /* ifndef DCO_H */
static bool dco_available(int msglevel)
Definition dco.h:270
static int dco_set_peer(dco_context_t *dco, unsigned int peerid, int keepalive_interval, int keepalive_timeout, int mss)
Definition dco.h:350
static const char * dco_get_supported_ciphers(void)
Definition dco.h:392
static bool dco_supports_epoch_data(struct context *c)
Definition dco.h:398
static int dco_do_read(dco_context_t *dco)
Definition dco.h:317
static void dco_event_set(dco_context_t *dco, struct event_set *es, void *arg)
Definition dco.h:324
static void dco_remove_peer(struct context *c)
Definition dco.h:357
static int open_tun_dco(struct tuntap *tt, openvpn_net_ctx_t *ctx, const char *dev)
Definition dco.h:306
static int dco_get_peer_stats_multi(dco_context_t *dco, struct multi_context *m, const bool raise_sigusr1_on_err)
Definition dco.h:379
static void dco_install_iroute(struct multi_context *m, struct multi_instance *mi, struct mroute_addr *addr)
Definition dco.h:368
static bool dco_check_startup_option(int msglevel, const struct options *o)
Definition dco.h:288
static int dco_p2p_add_new_peer(struct context *c)
Definition dco.h:344
static bool ovpn_dco_init(int mode, dco_context_t *dco, const char *dev_node)
Definition dco.h:300
static bool dco_check_option(int msglevel, const struct options *o)
Definition dco.h:282
static bool dco_update_keys(dco_context_t *dco, struct tls_multi *multi)
Definition dco.h:337
void * dco_context_t
Definition dco.h:267
static const char * dco_version_string(struct gc_arena *gc)
Definition dco.h:276
static int dco_multi_add_new_peer(struct multi_context *m, struct multi_instance *mi)
Definition dco.h:362
static void close_tun_dco(struct tuntap *tt, openvpn_net_ctx_t *ctx)
Definition dco.h:312
static void dco_delete_iroutes(struct multi_context *m, struct multi_instance *mi)
Definition dco.h:374
static int dco_get_peer_stats(struct context *c, const bool raise_sigusr1_on_err)
Definition dco.h:386
static bool dco_check_pull_options(int msglevel, const struct options *o)
Definition dco.h:294
static int init_key_dco_bi(struct tls_multi *multi, struct key_state *ks, const struct key2 *key2, int key_direction, const char *ciphername, bool server)
Definition dco.h:329
void * openvpn_net_ctx_t
Definition networking.h:39
#define ASSERT(x)
Definition error.h:195
Contains all state information for one tunnel.
Definition openvpn.h:474
Garbage collection arena used to keep track of dynamically allocated memory.
Definition buffer.h:117
Container for bidirectional cipher and HMAC key material.
Definition crypto.h:239
Security parameter state of one TLS and data channel key session.
Definition ssl_common.h:200
Main OpenVPN server state structure.
Definition multi.h:163
Server-mode state structure for one single VPN tunnel.
Definition multi.h:103
Security parameter state for a single VPN tunnel.
Definition ssl_common.h:597
Definition tun.h:181
dco_context_t dco
Definition tun.h:249
struct env_set * es
struct gc_arena gc
Definition test_ssl.c:155