From patchwork Fri Jun 4 04:28:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Wundram X-Patchwork-Id: 1849 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director8.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id EGvtI5s8umBTbwAAIUCqbw (envelope-from ) for ; Fri, 04 Jun 2021 10:45:47 -0400 Received: from proxy9.mail.ord1d.rsapps.net ([172.30.191.6]) by director8.mail.ord1d.rsapps.net with LMTP id sI3VI5s8umCOGwAAfY0hYg (envelope-from ) for ; Fri, 04 Jun 2021 10:45:47 -0400 Received: from smtp4.gate.ord1c ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy9.mail.ord1d.rsapps.net with LMTPS id 4OawI5s8umAxUgAA7h+8OQ (envelope-from ) for ; Fri, 04 Jun 2021 10:45:47 -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: smtp4.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=gehrkens.it X-Suspicious-Flag: YES X-Classification-ID: 8be78ebc-c543-11eb-9b3c-0024e87f2f2c-1-1 Received: from [216.105.38.7] ([216.105.38.7:54110] helo=lists.sourceforge.net) by smtp4.gate.ord1c.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id D5/2F-23194-A9C3AB06; Fri, 04 Jun 2021 10:45:47 -0400 Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.92.3) (envelope-from ) id 1lpB43-000773-47; Fri, 04 Jun 2021 14:44:47 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) (envelope-from ) id 1lpB41-00076w-Q4 for openvpn-devel@lists.sourceforge.net; Fri, 04 Jun 2021 14:44:45 +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=JSEnfeM8BaByACSVmNVVUbqkUr2mRH/ug6MURriE5Lw=; b=bQVD5u0JFtjmiMzO18S9bvwG6W JyxPkg9gY/5qRgCS682BDa5JZHGZhNLr3Mk7Er7nmkStaIz1x11ODwtXwBBMngBvg+mLzCUfTUK4e Jhd+9NonFOc4IIglpvndpmH+z0VfCWTlX+JV3/j1pHX7r7mvlvEe5Q+BNDW8570CxLak=; 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=JSEnfeM8BaByACSVmNVVUbqkUr2mRH/ug6MURriE5Lw=; b=U maUaWdSoOHZLQLP1Q/oGILkW+u5kq9RYIsw88LmhJzF4hk8gQulmqqfiPHWeK/yII6Z/DB9jLtgjX FijcDvWzPHME3hb+wlYw5jW99QjzdDq/12KDoOLzt0mVA91Z12L+cnl08Jz7aZUq3HFhn+U8kQ5aw EXJcoF14ODDPg1UM=; Received: from mailout00.id.gehrkens.it ([83.246.111.105]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) id 1lpB3r-0005oC-41 for openvpn-devel@lists.sourceforge.net; Fri, 04 Jun 2021 14:44:46 +0000 Received: from debdev.id.gehrkens.it (debdev.id.gehrkens.it [IPv6:fdb8:73da:6fd9:9:215:5dff:fefb:2632]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by mailout00.id.gehrkens.it (Postfix) with ESMTPS id 7AB86A8123F; Fri, 4 Jun 2021 16:28:56 +0200 (CEST) Received: by debdev.id.gehrkens.it (Postfix, from userid 66603) id 1C5C2361035; Fri, 4 Jun 2021 16:28:56 +0200 (CEST) From: Heiko Wundram To: openvpn-devel@lists.sourceforge.net Date: Fri, 4 Jun 2021 16:28:39 +0200 Message-Id: <20210604142846.4824-1-heiko.wundram@gehrkens.it> X-Mailer: git-send-email 2.20.1 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.4 NO_DNS_FOR_FROM DNS: Envelope sender has no MX or A DNS records 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-Headers-End: 1lpB3r-0005oC-41 Subject: [Openvpn-devel] [PATCH 1/8] 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: Gert Doering , 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 Message-Id: <20210505231255.1880-1-a@unstable.cc> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22315.html Signed-off-by: Gert Doering --- 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 */