From patchwork Wed Mar 8 15:19:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 3111 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:2310:b0:9f:bfa4:120f with SMTP id r16csp569203dye; Wed, 8 Mar 2023 07:20:49 -0800 (PST) X-Google-Smtp-Source: AK7set/40d20z7cocx+Z/TNd0jQW78UU9V2h2QbJpJeRSKC9LyiY51OA0UXOJQqcHLHolD17xNat X-Received: by 2002:a05:6a20:441d:b0:cc:4118:75f4 with SMTP id ce29-20020a056a20441d00b000cc411875f4mr19419624pzb.0.1678288849140; Wed, 08 Mar 2023 07:20:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678288849; cv=none; d=google.com; s=arc-20160816; b=E/rDCAz27JFJdWj1oUlurT3Hrv+QkyBEXkVSivNNynDpMBzNL1OGUZwFQ9Zm/Xlx+d Bmy0uzV7VCan6s1Dn5cxVow/3radD88PeFrLl4xT4vfb3EQbMpyFYlOTUk1e7FZn15W9 aHaDDLbUnfOlrNgTxgcRPX7U4YFFk2tpcjhTcRXq+ghiWRjlHMVXeM1rxuL0+BAGW8bo RV8yeCwkGnkeKlkQ/xsVejZ7xcGbqoq5Iowy5A+x20r0+KwSwdNGFCnXTuI+8zXErGGB t02/l2zc8cH084tOBoYP55p+9DaBERnQrs0q1nwcUjGgvmri7HNn5UgLsC0/uXtwa/9n BnGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:message-id:date:to:from:dkim-signature:dkim-signature; bh=yziuyBm9MgzoxVPY1UZFPoRI8ZOZBUWxRMkNJzdXjSU=; b=ocHoM2URTLEE6xFPXjzOti6kik8Gq4qRPwJ8vxF8oyTqxwGm8yk/itz057kFnC24Xm 0/Cviz9FPwxbRA+lUNQpei1cw/FZwwTY8KRTEKkHIooPRqgMc8qt6lQbPYBV3zv2IqYW cykC36E/uzJkty7mAEqVIW4fLUUIrUE8ftK+pVDLPRiIWqOqhbOFK6pgTLAsKnmTpZ3n utXIxANG7PfexaVTdtTUQfgAq6g8dQz85dF/i3Z26o6On7BNW/evpAqc5gQoIR3Anlmv /zfgC+Vt1sfcw/lEdBhMp0Ex2k8ChxxP1P6hA0652Hn95oKJ+31+1tBwmrt2WktYgg/X rKCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=dYMGQ0Hc; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=mqrHgJDX; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id k7-20020aa79727000000b0059d96ba730dsi15795613pfg.110.2023.03.08.07.20.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Mar 2023 07:20:49 -0800 (PST) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=dYMGQ0Hc; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=mqrHgJDX; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1pZva9-0001ru-RA; Wed, 08 Mar 2023 15:19:58 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pZva7-0001rn-7Z for openvpn-devel@lists.sourceforge.net; Wed, 08 Mar 2023 15:19:56 +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:To:From:Sender:Reply-To:Cc: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=6nKJxvCo7ZOXyacAab8NxeScfrZtjxWkpnIR4X8BfR8=; b=dYMGQ0HcjLoQ3FyWp/GKC1WvpC IrUnX6J00TOpor1JanL1zfBvG2i5ENmqlFn5sppPR8CLYOGYFTUqJUcfqBy8ESgO9AgQd+1qwvCpo vyR2pWq+WhrWpUuf3DdoKXjUc5FnEOjpvlvIQJ45ZSRXeeLgYBkfgHPJ3GkpqmrDFpOc=; 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:To:From: Sender:Reply-To:Cc: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=6nKJxvCo7ZOXyacAab8NxeScfrZtjxWkpnIR4X8BfR8=; b=m qrHgJDXYLM6M2/oUWYFFGKpvv6h1qW1zr7AkDzhd+zH3XjjGQaoVJjoGb3M4iC54QH1iyhTnsuTyV vvL+yN5XCCIF7jyqzdsWQ4okIzqD44uixNSTROBnSqEfPGbxhfC77H2XtW8y0NV4zKzxpcfUXjIg0 6Hiaq3kctEUuKgG8=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1pZva6-0000WL-1I for openvpn-devel@lists.sourceforge.net; Wed, 08 Mar 2023 15:19:56 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.95 (FreeBSD)) (envelope-from ) id 1pZvZx-000Jlq-Ni for openvpn-devel@lists.sourceforge.net; Wed, 08 Mar 2023 16:19:45 +0100 Received: (nullmailer pid 3670197 invoked by uid 10006); Wed, 08 Mar 2023 15:19:45 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Wed, 8 Mar 2023 16:19:45 +0100 Message-Id: <20230308151945.3670151-1-arne@rfc2549.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Score: 0.3 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-2.v13.lw.sourceforge.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Even though we use select/poll to explicitly query when the nextlink socket is ready for read, sometimes we end up reading from the socket when it is not ready to read and then the process hangs for s [...] Content analysis details: (0.3 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different X-Headers-End: 1pZva6-0000WL-1I Subject: [Openvpn-devel] [PATCH] Set netlink socket to be non-blocking 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: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1759813408347677386?= X-GMAIL-MSGID: =?utf-8?q?1759813408347677386?= Even though we use select/poll to explicitly query when the nextlink socket is ready for read, sometimes we end up reading from the socket when it is not ready to read and then the process hangs for several seoneds (20-30s). Avoid this situation by setting the socket to be non-blocking, so we get a status in this case that allows us to continue. Change-Id: I35447c23a9350176007df5455bf9451021e9856d Signed-off-by: Arne Schwabe Acked-by: Antonio Quartulli --- src/openvpn/dco_linux.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.c index 1a6566aad..6f1b999bb 100644 --- a/src/openvpn/dco_linux.c +++ b/src/openvpn/dco_linux.c @@ -359,7 +359,9 @@ ovpn_dco_init_netlink(dco_context_t *dco) nl_geterror(ret)); } + /* set close on exec and non-block on the netlink socket */ set_cloexec(nl_socket_get_fd(dco->nl_sock)); + set_nonblock(nl_socket_get_fd(dco->nl_sock)); dco->nl_cb = nl_cb_alloc(NL_CB_DEFAULT); if (!dco->nl_cb)