From patchwork Wed May 5 13:12:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 1794 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director8.mail.ord1d.rsapps.net ([172.28.255.1]) by backend30.mail.ord1d.rsapps.net with LMTP id GD58KKkmk2DQPgAAIUCqbw (envelope-from ) for ; Wed, 05 May 2021 19:13:45 -0400 Received: from proxy5.mail.ord1c.rsapps.net ([172.28.255.1]) by director8.mail.ord1d.rsapps.net with LMTP id WK4wKKkmk2BvUgAAfY0hYg (envelope-from ) for ; Wed, 05 May 2021 19:13:45 -0400 Received: from smtp26.gate.ord1c ([172.28.255.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy5.mail.ord1c.rsapps.net with LMTPS id UDMiKKkmk2CcOwAAPBRIyg (envelope-from ) for ; Wed, 05 May 2021 19:13:45 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp26.gate.ord1c.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dmarc=none (p=nil; dis=none) header.from=unstable.cc X-Suspicious-Flag: YES X-Classification-ID: 89f9f9ae-adf7-11eb-94a8-b8ca3a5bd12c-1-1 Received: from [216.105.38.7] ([216.105.38.7:33562] helo=lists.sourceforge.net) by smtp26.gate.ord1c.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id B3/93-01309-9A623906; Wed, 05 May 2021 19:13:45 -0400 Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1leQhJ-00087R-Bi; Wed, 05 May 2021 23:12:53 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leQhI-00087E-5S for openvpn-devel@lists.sourceforge.net; Wed, 05 May 2021 23:12:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=GBwbVw+Ryj/Iuju/qbN3TwYSYf5LJ1ZWh38AoajXvb4=; b=igpFFOtPeonJluY0lp30jfpW+Y Kf7fTudV0SbmLltxphHRek47EaNQ1gLqYifCYPBubgLm063vCQBabE7xV3uHMN5Mrd3bLVoHgqJMu 445p+LmNChkP1wEjUkLtVq6DLOWoh+6lX0w4tt+U7ZT6oBl1EWCy/WZq9zXRGC/DsfkI=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=GBwbVw+Ryj/Iuju/qbN3TwYSYf5LJ1ZWh38AoajXvb4=; b=l DQ85GwCNkLjjrOfMRtLKmTBGo1DK+KtMNJJXpeOOzjf2JdEz4kQ2v4I+LRdSWuzAcVH1Xcy2BhJVx 1OmE73mNLB4v9QDUx+eXYk5AVlAvFKAb3Mup336kdpgCafEdaeJwllZdkJ9iM627D/ifxLO6TU1VZ gBiL4X0BVByUf3zI=; Received: from s2.neomailbox.net ([5.148.176.60]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1leQhC-002Vn3-Nd for openvpn-devel@lists.sourceforge.net; Wed, 05 May 2021 23:12:52 +0000 From: Antonio Quartulli To: openvpn-devel@lists.sourceforge.net Date: Thu, 6 May 2021 01:12:55 +0200 Message-Id: <20210505231255.1880-1-a@unstable.cc> MIME-Version: 1.0 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: openvpn.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1leQhC-002Vn3-Nd Subject: [Openvpn-devel] [PATCH] forward: get rid of useless declarations for actually static functions X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Antonio Quartulli Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox From: Antonio Quartulli A bunch of functions defined in forward.c and declared in forward.h are actually used only in forward.c. For this very reason they don't need to be declared in forward.h at all and can be defined as static. Signed-off-by: Antonio Quartulli Acked-by: Lev Stipakov --- src/openvpn/forward.c | 50 +++++++++++++++++++++---------------------- src/openvpn/forward.h | 34 ----------------------------- 2 files changed, 25 insertions(+), 59 deletions(-) diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index e302d8e0..270c03c0 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -54,7 +54,7 @@ counter_type link_write_bytes_global; /* GLOBAL */ #ifdef ENABLE_DEBUG -const char * +static const char * wait_status_string(struct context *c, struct gc_arena *gc) { struct buffer out = alloc_buf_gc(64, gc); @@ -67,7 +67,7 @@ wait_status_string(struct context *c, struct gc_arena *gc) return BSTR(&out); } -void +static void show_wait_status(struct context *c) { struct gc_arena gc = gc_new(); @@ -77,6 +77,19 @@ show_wait_status(struct context *c) #endif /* ifdef ENABLE_DEBUG */ +static void +check_tls_errors_co(struct context *c) +{ + msg(D_STREAM_ERRORS, "Fatal TLS error (check_tls_errors_co), restarting"); + register_signal(c, c->c2.tls_exit_signal, "tls-error"); /* SOFT-SIGUSR1 -- TLS error */ +} + +static void +check_tls_errors_nco(struct context *c) +{ + register_signal(c, c->c2.tls_exit_signal, "tls-error"); /* SOFT-SIGUSR1 -- TLS error */ +} + /* * TLS errors are fatal in TCP mode. * Also check for --tls-exit trigger. @@ -138,7 +151,7 @@ context_reschedule_sec(struct context *c, int sec) * traffic on the control-channel. * */ -void +static void check_tls(struct context *c) { interval_t wakeup = BIG_TIMEOUT; @@ -176,24 +189,11 @@ check_tls(struct context *c) } } -void -check_tls_errors_co(struct context *c) -{ - msg(D_STREAM_ERRORS, "Fatal TLS error (check_tls_errors_co), restarting"); - register_signal(c, c->c2.tls_exit_signal, "tls-error"); /* SOFT-SIGUSR1 -- TLS error */ -} - -void -check_tls_errors_nco(struct context *c) -{ - register_signal(c, c->c2.tls_exit_signal, "tls-error"); /* SOFT-SIGUSR1 -- TLS error */ -} - /* * Handle incoming configuration * messages on the control channel. */ -void +static void check_incoming_control_channel(struct context *c) { int len = tls_test_payload_len(c->c2.tls_multi); @@ -258,7 +258,7 @@ check_incoming_control_channel(struct context *c) /* * Periodically resend PUSH_REQUEST until PUSH message received */ -void +static void check_push_request(struct context *c) { send_push_request(c); @@ -276,7 +276,7 @@ check_push_request(struct context *c) * Note: The process_incoming_push_reply currently assumes that this function * only sets up the pull request timer when pull is enabled. */ -void +static void check_connection_established(struct context *c) { @@ -370,7 +370,7 @@ check_add_routes_action(struct context *c, const bool errors) initialization_sequence_completed(c, errors ? ISC_ERRORS : 0); /* client/p2p --route-delay was defined */ } -void +static void check_add_routes(struct context *c) { if (test_routes(c->c1.route_list, c->c1.tuntap)) @@ -408,7 +408,7 @@ check_add_routes(struct context *c) /* * Should we exit due to inactivity timeout? */ -void +static void check_inactivity_timeout(struct context *c) { msg(M_INFO, "Inactivity timeout (--inactive), exiting"); @@ -423,7 +423,7 @@ get_server_poll_remaining_time(struct event_timeout *server_poll_timeout) return max_int(0, remaining); } -void +static void check_server_poll_timeout(struct context *c) { event_timeout_reset(&c->c2.server_poll_interval); @@ -453,7 +453,7 @@ schedule_exit(struct context *c, const int n_seconds, const int signal) /* * Scheduled exit? */ -void +static void check_scheduled_exit(struct context *c) { register_signal(c, c->c2.scheduled_exit_signal, "delayed-exit"); @@ -462,7 +462,7 @@ check_scheduled_exit(struct context *c) /* * Should we write timer-triggered status file. */ -void +static void check_status_file(struct context *c) { if (c->c1.status_output) @@ -475,7 +475,7 @@ check_status_file(struct context *c) /* * Should we deliver a datagram fragment to remote? */ -void +static void check_fragment(struct context *c) { struct link_socket_info *lsi = get_link_socket_info(c); diff --git a/src/openvpn/forward.h b/src/openvpn/forward.h index 2a67c144..5d7566cf 100644 --- a/src/openvpn/forward.h +++ b/src/openvpn/forward.h @@ -68,44 +68,12 @@ extern counter_type link_read_bytes_global; extern counter_type link_write_bytes_global; -void check_tls(struct context *c); - -void check_tls_errors_co(struct context *c); - -void check_tls_errors_nco(struct context *c); - -void check_incoming_control_channel(struct context *c); - -void check_scheduled_exit(struct context *c); - -void check_push_request(struct context *c); - -#ifdef ENABLE_FRAGMENT -void check_fragment(struct context *c); - -#endif /* ENABLE_FRAGMENT */ - -void check_connection_established(struct context *c); - -void check_add_routes(struct context *c); - -void check_inactivity_timeout(struct context *c); - -void check_server_poll_timeout(struct context *c); - -void check_status_file(struct context *c); - void io_wait_dowork(struct context *c, const unsigned int flags); void pre_select(struct context *c); void process_io(struct context *c); -const char *wait_status_string(struct context *c, struct gc_arena *gc); - -void show_wait_status(struct context *c); - - /**********************************************************************/ /** * Process a data channel packet that will be sent through a VPN tunnel. @@ -394,8 +362,6 @@ p2p_iow_flags(const struct context *c) static inline void io_wait(struct context *c, const unsigned int flags) { - void io_wait_dowork(struct context *c, const unsigned int flags); - if (c->c2.fast_io && (flags & (IOW_TO_TUN|IOW_TO_LINK|IOW_MBUF))) { /* fast path -- only for TUN/TAP/UDP writes */