From patchwork Wed Jul 23 06:30:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4322 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:9111:b0:671:5a2c:6455 with SMTP id h17csp757619maf; Tue, 22 Jul 2025 23:30:51 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXBEPqmvGgzhbEv3c+L41wVeZwvFdeNyvpXFjc03u41XADmWQ2R4SZT6zMAY6fm3C5y7fvgp7Q8SeA=@openvpn.net X-Google-Smtp-Source: AGHT+IE1TG+jvB+VvyXQAwlB59OhRxG5GLCfEnGft7if7qmp2/UjgYKbFZYNTj1BYqI1n/xXx0nu X-Received: by 2002:a05:6808:1a0a:b0:41f:79f9:1b6b with SMTP id 5614622812f47-426ce0a15e8mr1323739b6e.34.1753252250956; Tue, 22 Jul 2025 23:30:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1753252250; cv=none; d=google.com; s=arc-20240605; b=ftOZqRcFzxB4YJgOmAa36P3IcbWYAXufKGoCiefIzrOVabaEb8XnPXY5JO/rIi6rhy ejF6mh3HUshIs0ESQKkfv7LqMYelRsB+4Xx6PGvJcgx08lmfE+hlth69VFt/Q9VkC/fz 60y6efzwOfy2FQhcLcokykxY8bo3ltpe/ko/iOgZZXMRndtmnAYzHm+P4E+QzHpH00me NWCGm95oMZl3G9Npm94xZQTYoIHyWxKIZAjvUHt8h0quJnAC4tUXVzXMW8U3lD4JtZf2 PQmoNReBkJnb+ZPmPHsP6FXFahTehUCqFUOtb3D4hpFEulnhJUh2HVCGRNdcqOtC/6VN 2ANQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=bJLvsBOWQgYFdx0eayok0hzJrqSfJmYR0csl+zhkn5E=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=Spgrbhniup3gKUiPxv6EDhGNjj2h7iRtA7euJVlm3ncMxtXXR+PrER3FOeNcAGnZg+ 3ZqAMAP5d3HMhLMAagHVEyuPMuTcESbcmEEse/bDiREY4oL/HzNEcT0J2Q3d5YmOkpDN P5XaNSVyCKzPWNsOFkUU4kEi4DLGUYAnrwxwLwZkp64ePaAZ89cH8aDVlDpS08roJd8B jJsgw+ph46NX7Qu7/4ljFv1E6k3aMwxAUBYVeES63d+9llu98Pbf2/Q5B42yoPEhX19b juVa2S43oY83ks4884Mg8nSRgrG7wdJCTX8wYRMtCuS/9UlWa0RM4yS2zO60sp+gXFUF Y50Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=eN0cUjJ2; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=SqSXMN2R; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=cmBLniIw; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 5614622812f47-41fd428b02csi5499894b6e.110.2025.07.22.23.30.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Jul 2025 23:30:50 -0700 (PDT) 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=pass header.i=@lists.sourceforge.net header.s=beta header.b=eN0cUjJ2; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=SqSXMN2R; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=cmBLniIw; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bJLvsBOWQgYFdx0eayok0hzJrqSfJmYR0csl+zhkn5E=; b=eN0cUjJ2miQHgujSi76ZOq91Gm c3hAh3ITXFUeXGAp+6eSM7SJRKBXUI62x3mLReObjl32QYVFHuIjDF3j0VZ3PNEIGY6pSo6VJWayj sPeBInUG6W/9AXZsEPwix7BGWmfb9BU4WndjNxEl2MNealJflO7CYA+TyVObOvX1pFsc=; 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.95) (envelope-from ) id 1ueT05-00070a-2b; Wed, 23 Jul 2025 06:30:49 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1ueT03-00070U-UB for openvpn-devel@lists.sourceforge.net; Wed, 23 Jul 2025 06:30:47 +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:References: In-Reply-To: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:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=OB8Wz3+AuXsDIgUTM8F00cHw5iWIp5DOCvz2JwmU3ww=; b=SqSXMN2RF5mS4iz37Krhj2mvKY J7BxKb4n8mXiGtQEKEbbSxCrtH7+oim0Ko6d4YYRIGDRYgQ7MNXS2Durp0Hfx7WMFrk2tfrBhUZZn Xw0DgD5QBnOExQjGgxZBDrM7+RLsZNCYvKUHMll7rqNP+4PGxuWexzb2HnwJh7E11aWI=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: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:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=OB8Wz3+AuXsDIgUTM8F00cHw5iWIp5DOCvz2JwmU3ww=; b=cmBLniIwHcJls3XivmOUaSlsGQ 3/aM1ur30MNEr17EBZFFMeY7gVcBPU1axsMRtNmV0KXVR8GjCNSebiHIVF+yr+/jxGagv9ZCPCw3f tL/I4ZArH66dWEOZXgIQW+1kEVn02kL3Z4S2RYTjElgL+8nZqnb1OPbKMwY4/LDA2wpw=; Received: from [193.149.48.143] (helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1ueT02-0007eK-JY for openvpn-devel@lists.sourceforge.net; Wed, 23 Jul 2025 06:30:47 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.17.1.9/8.17.1.9) with ESMTP id 56N6UeHU025489 for ; Wed, 23 Jul 2025 08:30:40 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.17.1.9/8.17.1.9/Submit) id 56N6UejJ025485 for openvpn-devel@lists.sourceforge.net; Wed, 23 Jul 2025 08:30:40 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Wed, 23 Jul 2025 08:30:30 +0200 Message-ID: <20250723063039.25449-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-1.hosts.colo.sdot.me", 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: Antonio Quartulli Netlink code doesn't set errno upon error (with the exception of any *alloc() function which probably inherits the errno=ENOMEM from the underlying malloc call), therefore we should not print error me [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1ueT02-0007eK-JY Subject: [Openvpn-devel] [PATCH v2] dco_linux: use M_FATAL instead of M_ERR in netlink error code paths 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?1838418232245809125?= X-GMAIL-MSGID: =?utf-8?q?1838418232245809125?= From: Antonio Quartulli Netlink code doesn't set errno upon error (with the exception of any *alloc() function which probably inherits the errno=ENOMEM from the underlying malloc call), therefore we should not print error messages with M_ERR, but rather rely on M_FATAL. M_ERR is equivalent to M_FATAL with the addition of appending ": $errno" to the error string. Since errno is not meaningful in this context, we can just opt for the less confusing M_FATAL. Change-Id: Ifc442b4426c02de7282d0f69629e8a10b679c589 Signed-off-by: Antonio Quartulli Acked-by: Gert Doering --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1096 This mail reflects revision 2 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.c index 58051f5..13506a1 100644 --- a/src/openvpn/dco_linux.c +++ b/src/openvpn/dco_linux.c @@ -114,7 +114,7 @@ struct nl_msg *nl_msg = nlmsg_alloc(); if (!nl_msg) { - msg(M_ERR, "cannot allocate netlink message"); + msg(M_FATAL, "cannot allocate netlink message"); return NULL; } @@ -140,7 +140,7 @@ break; case -NLE_NOMEM: - msg(M_ERR, "%s: netlink out of memory error", prefix); + msg(M_FATAL, "%s: netlink out of memory error", prefix); break; case -NLE_AGAIN: @@ -148,7 +148,7 @@ break; case -NLE_NODEV: - msg(M_ERR, "%s: netlink reports device not found:", prefix); + msg(M_FATAL, "%s: netlink reports device not found:", prefix); break; case -NLE_OBJ_NOTFOUND: @@ -387,19 +387,19 @@ static void ovpn_dco_init_netlink(dco_context_t *dco) { - dco->ovpn_dco_id = resolve_ovpn_netlink_id(M_ERR); + dco->ovpn_dco_id = resolve_ovpn_netlink_id(M_FATAL); dco->nl_sock = nl_socket_alloc(); if (!dco->nl_sock) { - msg(M_ERR, "Cannot create netlink socket"); + msg(M_FATAL, "Cannot create netlink socket"); } int ret = genl_connect(dco->nl_sock); if (ret) { - msg(M_ERR, "Cannot connect to generic netlink: %s", + msg(M_FATAL, "Cannot connect to generic netlink: %s", nl_geterror(ret)); } @@ -415,7 +415,7 @@ dco->nl_cb = nl_cb_alloc(NL_CB_DEFAULT); if (!dco->nl_cb) { - msg(M_ERR, "failed to allocate netlink callback"); + msg(M_FATAL, "failed to allocate netlink callback"); } nl_socket_set_cb(dco->nl_sock, dco->nl_cb); @@ -484,7 +484,7 @@ if (dco->ovpn_dco_mcast_id < 0) { - msg(M_ERR, "cannot get mcast group: %s", nl_geterror(dco->ovpn_dco_mcast_id)); + msg(M_FATAL, "cannot get mcast group: %s", nl_geterror(dco->ovpn_dco_mcast_id)); } /* Register for ovpn-dco specific multicast messages that the kernel may @@ -493,7 +493,7 @@ int ret = nl_socket_add_membership(dco->nl_sock, dco->ovpn_dco_mcast_id); if (ret) { - msg(M_ERR, "%s: failed to join groups: %d", __func__, ret); + msg(M_FATAL, "%s: failed to join groups: %d", __func__, ret); } }