From: Antonio Quartulli
Function prototypes should be included when compiling their
definitions so that it is clear to compilers and static
analyzers that they are not static.
This means that several declarations have to be moved to the
related header files which in turn have to be included by the
source files implementing them.
Generally speaking this also improves the coding style and
makes this code more consistent with the rest that already
follows this rule.
Signed-off-by: Antonio Quartulli
---
v2: rebased on top of latest master to avoid conflict
src/openvpn/crypto.h | 3 +++
src/openvpn/error.c | 3 +--
src/openvpn/forward-inline.h | 28 ++--
src/openvpn/forward.h| 35 +++
src/openvpn/init.h | 2 ++
src/openvpn/lladdr.c | 1 +
src/openvpn/manage.h | 11 ++-
src/openvpn/mbuf.h | 4 ++--
src/openvpn/mroute.h | 21 +++--
src/openvpn/multi.h | 7 +++
src/openvpn/occ-inline.h | 8 ++--
src/openvpn/occ.h| 6 ++
src/openvpn/pf-inline.h | 6 ++
src/openvpn/pf.h | 6 ++
src/openvpn/ping-inline.h| 6 ++
src/openvpn/ping.h | 4
src/openvpn/plugin.h | 2 ++
src/openvpn/socket.h | 13 +++--
18 files changed, 97 insertions(+), 69 deletions(-)
diff --git a/src/openvpn/crypto.h b/src/openvpn/crypto.h
index f1b6c20a..5f0790a6 100644
--- a/src/openvpn/crypto.h
+++ b/src/openvpn/crypto.h
@@ -467,6 +467,9 @@ void prng_bytes(uint8_t *output, int len);
void prng_uninit(void);
+/* an analogue to the random() function, but use prng_bytes */
+long int get_random(void);
+
void test_crypto(struct crypto_options *co, struct frame *f);
diff --git a/src/openvpn/error.c b/src/openvpn/error.c
index 04bf0da5..e885ec3b 100644
--- a/src/openvpn/error.c
+++ b/src/openvpn/error.c
@@ -31,6 +31,7 @@
#include "error.h"
#include "buffer.h"
+#include "init.h"
#include "misc.h"
#include "win32.h"
#include "socket.h"
@@ -734,8 +735,6 @@ openvpn_exit(const int status)
{
if (!forked)
{
-void tun_abort();
-
#ifdef ENABLE_PLUGIN
void plugin_abort(void);
diff --git a/src/openvpn/forward-inline.h b/src/openvpn/forward-inline.h
index ab83ea40..04601e8c 100644
--- a/src/openvpn/forward-inline.h
+++ b/src/openvpn/forward-inline.h
@@ -24,6 +24,8 @@
#ifndef FORWARD_INLINE_H
#define FORWARD_INLINE_H
+#include "forward.h"
+
/*
* Inline functions
*/
@@ -35,8 +37,6 @@ static inline void
check_tls(struct context *c)
{
#if defined(ENABLE_CRYPTO)
-void check_tls_dowork(struct context *c);
-
if (c->c2.tls_multi)
{
check_tls_dowork(c);
@@ -52,10 +52,6 @@ static inline void
check_tls_errors(struct context *c)
{
#if defined(ENABLE_CRYPTO)
-void check_tls_errors_co(struct context *c);
-
-void check_tls_errors_nco(struct context *c);
-
if (c->c2.tls_multi && c->c2.tls_exit_signal)
{
if (link_socket_connection_oriented(c->c2.link_socket))
@@ -84,8 +80,6 @@ static inline void
check_incoming_control_channel(struct context *c)
{
#if P2MP
-void check_incoming_control_channel_dowork(struct context *c);
-
if (tls_test_payload_len(c->c2.tls_multi) > 0)
{
check_incoming_control_channel_dowork(c);
@@ -100,8 +94,6 @@ check_incoming_control_channel(struct context *c)
static inline void
check_connection_established(struct context *c)
{
-void check_connection_established_dowork(struct context *c);
-
if (event_timeout_defined(&c->c2.wait_for_connect))
{
check_connection_established_dowork(c);
@@ -114,8 +106,6 @@ check_connection_established(struct context *c)
static inline void
check_add_routes(struct context *c)
{
-void check_add_routes_dowork(struct context *c);
-
if (event_timeout_trigger(&c->c2.route_wakeup, &c->c2.timeval,
ETT_DEFAULT))
{
check_add_routes_dowork(c);
@@ -128,8 +118,6 @@ check_add_routes(struct context *c)
static inline void
check_inactivity_timeout(struct context *c)
{
-void check_inactivity_timeout_dowork(struct context *c);
-
if (c->options.inactivity_timeout
&& event_timeout_trigger(&c->c2.inactivity_interval, &c->c2.timeval,
ETT_DEFAULT))
{
@@ -142,8 +130,6 @@ check_inactivity_timeout(struct context *c)
static inline void
check_server_poll_timeout(struct context *c)
{
-void check_server_poll_timeout_dowork(struct context *c);
-
if (c->options.ce.connect_timeout
&& event_timeout_trigger(&c->c2.server_poll_interval, &c->c2.timeval,
ETT_DEFAULT))
{
@@ -157,8 +143,6 @@ check_server_poll_timeout(struct context *c)
static inline void
check_scheduled_exit(struct context *c)
{
-void check_scheduled_exit_dowork(struct context *c);
-
if (event_timeout_defined(&c->c2.scheduled_exit))
{
if (event_timeout_trigger(&c->c2.schedu