Message ID | 20221026082104.984208-1-lkml@jv-coder.de |
---|---|
State | Accepted |
Delegated to: | Hauke Mehrtens |
Headers | show
Return-Path: <openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=<UNKNOWN>) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=HO8ClQHN; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=jv-coder.de header.i=@jv-coder.de header.a=rsa-sha256 header.s=dkim header.b=tXy8IXjn; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4My2034gNHz1ygr for <incoming@patchwork.ozlabs.org>; Wed, 26 Oct 2022 19:24:03 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Elx60RtkSRw6dchNEY3yCDnOpcJQHQvR0ObMxJQ1vyA=; b=HO8ClQHNL/AvSE 0srothB1Svp/tfWhTwRSvUnFoKVVXQZjC5jWCmpRcPPt1oOFvsLum+uiZTCYLCKs9UOnA5G7Na59V RcEfadA2B+1ihXfdCbGjr4FGDPgSfu+BcrnYz5g6KhkEZh1sS7EjMEYDGkln5xOMaBncc0Fp1+cmK S4Ynv1r0Z3h/9l0wKfFxNbspsXA1ArqkuQq92FE43xIc0qYxMX5hMmRk8AQCC+5eLF3Nx0lkHyERa E25HHeGf+TiYMjg/OWmackI1ZrAwFPxl9cRFK/XDEDS6rQ8eAoVpQw+8+1myn+1vAejp0j9C8Bz77 4TnVGGPe0wUPlIOJ7W3Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1onbfQ-008XVz-Qm; Wed, 26 Oct 2022 08:21:40 +0000 Received: from mail.jv-coder.de ([5.9.79.73]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1onbfC-008XQw-TS for openwrt-devel@lists.openwrt.org; Wed, 26 Oct 2022 08:21:29 +0000 Received: from ubuntu.localdomain (unknown [37.156.92.209]) by mail.jv-coder.de (Postfix) with ESMTPSA id 1861B9F650; Wed, 26 Oct 2022 08:21:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jv-coder.de; s=dkim; t=1666772482; bh=1Id+Uw/dXbgmckFGS4yMQ2FRr5EfopFs9ykRh06E4AY=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=tXy8IXjn89nzUivgcDIX+i4tFZhXZfoX6A7Qm4GG5Imiss2fYn8TxOLtc8EZY3IUd rECiJxm6py+9vbwtTjzhDPsmewpMMrKHgn2oje2hUwvlRcicgOiwpgnmXENazzjia0 eob8bm1LU9aFFwv6TRC1MhDIoE1G9cS9oQupnbNE= From: Joerg Vehlow <lkml@jv-coder.de> To: openwrt-devel@lists.openwrt.org, nbd@nbd.name, ynezz@true.cz Cc: Joerg Vehlow <joerg.vehlow@aox.de> Subject: [PATCH] libnl-tiny: set SOCK_CLOEXEC if available Date: Wed, 26 Oct 2022 10:21:04 +0200 Message-Id: <20221026082104.984208-1-lkml@jv-coder.de> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,UNPARSEABLE_RELAY autolearn=disabled version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mail X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221026_012127_144365_BEFAD704 X-CRM114-Status: UNSURE ( 9.57 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", 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: From: Joerg Vehlow <joerg.vehlow@aox.de> If CLOEXEC is not set on the netlink socket, restarting netifd using ubus fails with "Failed to initialize system control", because the bind call in nl_connect fails with EADDRINUSE, due to the inheri [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List <openwrt-devel.lists.openwrt.org> List-Unsubscribe: <https://lists.openwrt.org/mailman/options/openwrt-devel>, <mailto:openwrt-devel-request@lists.openwrt.org?subject=unsubscribe> List-Archive: <http://lists.openwrt.org/pipermail/openwrt-devel/> List-Post: <mailto:openwrt-devel@lists.openwrt.org> List-Help: <mailto:openwrt-devel-request@lists.openwrt.org?subject=help> List-Subscribe: <https://lists.openwrt.org/mailman/listinfo/openwrt-devel>, <mailto:openwrt-devel-request@lists.openwrt.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "openwrt-devel" <openwrt-devel-bounces@lists.openwrt.org> Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org |
Series |
libnl-tiny: set SOCK_CLOEXEC if available
|
expand
|
diff --git a/nl.c b/nl.c index c875573..32d26a3 100644 --- a/nl.c +++ b/nl.c @@ -106,9 +106,14 @@ int nl_connect(struct nl_sock *sk, int protocol) { int err; + int flags = 0; socklen_t addrlen; - sk->s_fd = socket(AF_NETLINK, SOCK_RAW, protocol); +#ifdef SOCK_CLOEXEC + flags = SOCK_CLOEXEC; +#endif + + sk->s_fd = socket(AF_NETLINK, SOCK_RAW | flags, protocol); if (sk->s_fd < 0) { err = -nl_syserr2nlerr(errno); goto errout;