summaryrefslogtreecommitdiff
path: root/src/openvpn/ping.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvpn/ping.c')
-rw-r--r--src/openvpn/ping.c72
1 files changed, 37 insertions, 35 deletions
diff --git a/src/openvpn/ping.c b/src/openvpn/ping.c
index 6dc0b4e..0496b72 100644
--- a/src/openvpn/ping.c
+++ b/src/openvpn/ping.c
@@ -5,7 +5,7 @@
* packet encryption, packet authentication, and
* packet compression.
*
- * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net>
+ * Copyright (C) 2002-2017 OpenVPN Technologies, Inc. <sales@openvpn.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
@@ -44,8 +44,8 @@
* PING_STRING_SIZE must be sizeof (ping_string)
*/
const uint8_t ping_string[] = {
- 0x2a, 0x18, 0x7b, 0xf3, 0x64, 0x1e, 0xb4, 0xcb,
- 0x07, 0xed, 0x2d, 0x0a, 0x98, 0x1f, 0xc7, 0x48
+ 0x2a, 0x18, 0x7b, 0xf3, 0x64, 0x1e, 0xb4, 0xcb,
+ 0x07, 0xed, 0x2d, 0x0a, 0x98, 0x1f, 0xc7, 0x48
};
/*
@@ -53,46 +53,48 @@ const uint8_t ping_string[] = {
* not received in n seconds?
*/
void
-check_ping_restart_dowork (struct context *c)
+check_ping_restart_dowork(struct context *c)
{
- struct gc_arena gc = gc_new ();
- switch (c->options.ping_rec_timeout_action)
+ struct gc_arena gc = gc_new();
+ switch (c->options.ping_rec_timeout_action)
{
- case PING_EXIT:
- msg (M_INFO, "%sInactivity timeout (--ping-exit), exiting",
- format_common_name (c, &gc));
- c->sig->signal_received = SIGTERM;
- c->sig->signal_text = "ping-exit";
- break;
- case PING_RESTART:
- msg (M_INFO, "%sInactivity timeout (--ping-restart), restarting",
- format_common_name (c, &gc));
- c->sig->signal_received = SIGUSR1; /* SOFT-SIGUSR1 -- Ping Restart */
- c->sig->signal_text = "ping-restart";
- break;
- default:
- ASSERT (0);
+ case PING_EXIT:
+ msg(M_INFO, "%sInactivity timeout (--ping-exit), exiting",
+ format_common_name(c, &gc));
+ c->sig->signal_received = SIGTERM;
+ c->sig->signal_text = "ping-exit";
+ break;
+
+ case PING_RESTART:
+ msg(M_INFO, "%sInactivity timeout (--ping-restart), restarting",
+ format_common_name(c, &gc));
+ c->sig->signal_received = SIGUSR1; /* SOFT-SIGUSR1 -- Ping Restart */
+ c->sig->signal_text = "ping-restart";
+ break;
+
+ default:
+ ASSERT(0);
}
- gc_free (&gc);
+ gc_free(&gc);
}
/*
* Should we ping the remote?
*/
void
-check_ping_send_dowork (struct context *c)
+check_ping_send_dowork(struct context *c)
{
- c->c2.buf = c->c2.buffers->aux_buf;
- ASSERT (buf_init (&c->c2.buf, FRAME_HEADROOM (&c->c2.frame)));
- ASSERT (buf_safe (&c->c2.buf, MAX_RW_SIZE_TUN (&c->c2.frame)));
- ASSERT (buf_write (&c->c2.buf, ping_string, sizeof (ping_string)));
+ c->c2.buf = c->c2.buffers->aux_buf;
+ ASSERT(buf_init(&c->c2.buf, FRAME_HEADROOM(&c->c2.frame)));
+ ASSERT(buf_safe(&c->c2.buf, MAX_RW_SIZE_TUN(&c->c2.frame)));
+ ASSERT(buf_write(&c->c2.buf, ping_string, sizeof(ping_string)));
- /*
- * We will treat the ping like any other outgoing packet,
- * encrypt, sign, etc.
- */
- encrypt_sign (c, true);
- /* Set length to 0, so it won't be counted as activity */
- c->c2.buf.len = 0;
- dmsg (D_PING, "SENT PING");
-}
+ /*
+ * We will treat the ping like any other outgoing packet,
+ * encrypt, sign, etc.
+ */
+ encrypt_sign(c, true);
+ /* Set length to 0, so it won't be counted as activity */
+ c->c2.buf.len = 0;
+ dmsg(D_PING, "SENT PING");
+}