OpenVPN
ping.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-2025 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, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifndef PING_H
24#define PING_H
25
26#include "init.h"
27#include "forward.h"
28
29/*
30 * Initial default --ping-restart before --pull
31 */
32#define PRE_PULL_INITIAL_PING_RESTART 120 /* in seconds */
33
34extern const uint8_t ping_string[];
35
36/* PING_STRING_SIZE must be sizeof (ping_string) */
37#define PING_STRING_SIZE 16
38
39static inline bool
40is_ping_msg(const struct buffer *buf)
41{
43}
44
51
52void check_ping_send_dowork(struct context *c);
53
54/*
55 * Should we exit or restart due to ping (or other authenticated packet)
56 * not received in n seconds?
57 */
58static inline void
71
72/*
73 * Should we ping the remote?
74 */
75static inline void
85
86#endif /* ifndef PING_H */
static bool buf_string_match(const struct buffer *src, const void *match, int size)
Compare src buffer contents with match.
Definition buffer.h:831
Interface functions to the internal and external multiplexers.
#define TO_LINK_DEF(c)
Definition forward.h:47
bool event_timeout_trigger(struct event_timeout *et, struct timeval *tv, const int et_const_retry)
This is the principal function for testing and triggering recurring timers.
Definition interval.c:42
#define ETT_DEFAULT
Definition interval.h:222
const uint8_t ping_string[]
Definition ping.c:41
#define PING_STRING_SIZE
Definition ping.h:37
static void check_ping_restart(struct context *c)
Definition ping.h:59
void trigger_ping_timeout_signal(struct context *c)
Trigger the correct signal on a –ping timeout depending if –ping-exit is set (SIGTERM) or not (SIGUSR...
Definition ping.c:45
void check_ping_send_dowork(struct context *c)
Definition ping.c:71
static bool is_ping_msg(const struct buffer *buf)
Definition ping.h:40
static void check_ping_send(struct context *c)
Definition ping.h:76
static bool link_socket_actual_defined(const struct link_socket_actual *act)
Wrapper structure for dynamically allocated memory.
Definition buffer.h:60
struct link_socket_addr * link_socket_addrs
Local and remote addresses on the external network.
Definition openvpn.h:159
struct event_timeout ping_send_interval
Definition openvpn.h:283
struct timeval timeval
Time to next event of timers and similar.
Definition openvpn.h:396
struct event_timeout ping_rec_interval
Definition openvpn.h:284
Contains all state information for one tunnel.
Definition openvpn.h:474
struct context_2 c2
Level 2 context.
Definition openvpn.h:517
struct options options
Options loaded from command line or configuration file.
Definition openvpn.h:475
struct context_1 c1
Level 1 context.
Definition openvpn.h:516
bool ping_timer_remote
Definition options.h:352
int ping_rec_timeout
Definition options.h:351
int ping_send_timeout
Definition options.h:350