From patchwork Mon Aug 10 04:36:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1358 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director9.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id cJzNKsxbMV99fQAAIUCqbw for ; Mon, 10 Aug 2020 10:38:04 -0400 Received: from proxy2.mail.ord1d.rsapps.net ([172.30.191.6]) by director9.mail.ord1d.rsapps.net with LMTP id 2LaqKsxbMV/dFgAAalYnBA (envelope-from ) for ; Mon, 10 Aug 2020 10:38:04 -0400 Received: from smtp9.gate.ord1c ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy2.mail.ord1d.rsapps.net with LMTP id sLN7KsxbMV9OJwAAfawv4w ; Mon, 10 Aug 2020 10:38:04 -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: smtp9.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=rfc2549.org X-Suspicious-Flag: YES X-Classification-ID: 185a5482-db17-11ea-96ed-0026b95bddb7-1-1 Received: from [216.105.38.7] ([216.105.38.7:46270] helo=lists.sourceforge.net) by smtp9.gate.ord1c.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 6C/79-16801-BCB513F5; Mon, 10 Aug 2020 10:38:03 -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 1k58vO-0007CJ-E3; Mon, 10 Aug 2020 14:37:18 +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 1k58vN-0007By-1L for openvpn-devel@lists.sourceforge.net; Mon, 10 Aug 2020 14:37:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=References:In-Reply-To:Message-Id:Date:Subject:To: From:Sender:Reply-To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=PzNt1RMeHcgQkwjoemM4Jh7GKHvVH35NA0LYFTtR5KE=; b=CXXcV7LKcemEIjrYY++/GGsw0N xwyAvERD3tYPWnurX1nuKBNwXARybuqcj0Nj6tiMLW9EbY47YCaNbEg9q4LRQv82z68yJBmZ3bDzv AS4W2rxkxtFYVIOluetBWHyDdT0WqZjLhvhZE+qojIomrl1Og8x9lGcKlGrMIUokz1Yo=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=References:In-Reply-To:Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc :MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=PzNt1RMeHcgQkwjoemM4Jh7GKHvVH35NA0LYFTtR5KE=; b=jrstVhv04FH2uMqHEqjujahmK2 zdyJP+OLpAGaCWRzcGie5GlBSIXsgI0WDtxDPiRmrGjSplZzeZ6TaNk0lpWDzZCD/rQ5rjaKyl4zK DLtUopnjvnEElr72LnOL42uJwTUFy4qpaWnbKw8udRkkoOt4mL5gMMt1bwpB6WpN8xBI=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-4.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1k58vL-005kqx-5k for openvpn-devel@lists.sourceforge.net; Mon, 10 Aug 2020 14:37:16 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.94 (FreeBSD)) (envelope-from ) id 1k58vE-000OSC-Iz for openvpn-devel@lists.sourceforge.net; Mon, 10 Aug 2020 16:37:08 +0200 Received: (nullmailer pid 5904 invoked by uid 10006); Mon, 10 Aug 2020 14:37:08 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Mon, 10 Aug 2020 16:36:58 +0200 Message-Id: <20200810143707.5834-9-arne@rfc2549.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200810143707.5834-1-arne@rfc2549.org> References: <20200810143707.5834-1-arne@rfc2549.org> X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 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 -0.0 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1k58vL-005kqx-5k Subject: [Openvpn-devel] [PATCH 08/17] Rename check_ping_restart_dowork to trigger_ping_timeout_signal 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: , MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox Rename the function to better capture its actual function. Signed-off-by: Arne Schwabe Acked-by: Gert Doering --- src/openvpn/ping.c | 6 +----- src/openvpn/ping.h | 13 +++++++------ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/openvpn/ping.c b/src/openvpn/ping.c index 358d54b0..aa176fdb 100644 --- a/src/openvpn/ping.c +++ b/src/openvpn/ping.c @@ -46,12 +46,8 @@ const uint8_t ping_string[] = { 0x07, 0xed, 0x2d, 0x0a, 0x98, 0x1f, 0xc7, 0x48 }; -/* - * Should we exit or restart due to ping (or other authenticated packet) - * not received in n seconds? - */ void -check_ping_restart_dowork(struct context *c) +trigger_ping_timeout_signal(struct context *c) { struct gc_arena gc = gc_new(); switch (c->options.ping_rec_timeout_action) diff --git a/src/openvpn/ping.h b/src/openvpn/ping.h index b51f082a..6feaa878 100644 --- a/src/openvpn/ping.h +++ b/src/openvpn/ping.h @@ -43,7 +43,12 @@ is_ping_msg(const struct buffer *buf) return buf_string_match(buf, ping_string, PING_STRING_SIZE); } -void check_ping_restart_dowork(struct context *c); +/** + * Trigger the correct signal on a --ping timeout + * depending if --ping-exit is set (SIGTERM) or not + * (SIGUSR1) + */ +void trigger_ping_timeout_signal(struct context *c); void check_ping_send_dowork(struct context *c); @@ -54,8 +59,6 @@ void check_ping_send_dowork(struct context *c); static inline void check_ping_restart(struct context *c) { - void check_ping_restart_dowork(struct context *c); - if (c->options.ping_rec_timeout && event_timeout_trigger(&c->c2.ping_rec_interval, &c->c2.timeval, @@ -63,7 +66,7 @@ check_ping_restart(struct context *c) || link_socket_actual_defined(&c->c1.link_socket_addr.actual)) ? ETT_DEFAULT : 15)) { - check_ping_restart_dowork(c); + trigger_ping_timeout_signal(c); } } @@ -73,8 +76,6 @@ check_ping_restart(struct context *c) static inline void check_ping_send(struct context *c) { - void check_ping_send_dowork(struct context *c); - if (c->options.ping_send_timeout && event_timeout_trigger(&c->c2.ping_send_interval, &c->c2.timeval,