From patchwork Mon Jun 9 10:02:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4279 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:6370:c188:10b0:668:42a9:9967 with SMTP id yj8-n1csp1589409mab; Mon, 9 Jun 2025 03:02:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXtTaK/JdWFTfDCozbE8M9R9bsrsXGxBMjZC4y+uK8KAg3QiyFB/+WFADBPryfrOGaZV9REJ7lkTyg=@openvpn.net X-Google-Smtp-Source: AGHT+IF5BE9+j+wjUYMkbz2znrIzxvDZP6S+PxPzNCaPhZ8372MtE7jzn8LIAZr9//N5Z2c74gjE X-Received: by 2002:a05:6808:3307:b0:408:fbb6:f4cb with SMTP id 5614622812f47-409051a4f95mr9090865b6e.6.1749463355958; Mon, 09 Jun 2025 03:02:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1749463355; cv=none; d=google.com; s=arc-20240605; b=LQFXLKX8Ofbp25JRM6Pe4kNknj/tBpY5J5QObVN/qfCr2UbyUphuJjD1I0uAtEyZva RtFkHivfCoIuZ63lMNX2+pxBy9Dy2GcZ2VXi0h/j46jWkPdl7L53MxY6S+WBGDO3HZ+t b3LrmslP+gNpllijhks4ok5IMM6kP0hykfl5SwnqJDtAHZ6Y9okQ+Twn9N0i+UCQRlhI 0/lV0ppAPHWRSLtpbFzX4j6ZWlS+Bby8TXz9kw8eFU3btd5iaO6FSal47sny/lq4NNyo iSmxXIkhq5GAId0IPMuRRBeX9OMhLXI20Rpoo+JMqLJoUHPw29QyKpqNlvGhcv5bVzbf lAbg== 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=ObZ/Jrv6HTLKho43Q/8wNTTM45k6gTikg3C1NtV61uU=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=hlveGx/W11jN4iaXDZso2vx6I49hms9+AEe3qo1hsAy+ZBcAOKvN+mZ7xOUsBwdhFy JSthWNZqvldS8DiKAZkPcoQX4wDqY0d3lDxMZOC8iBJ76Qf0f5OUGFpqTrcNzcGdAhTJ lzrzk75ikray840E0OGCP8wQ+HVfZiVplh5Goj8NVHg0AOuJTwwXNs2Y3MaTiSvQciet 3ohgCMQYYc98vbF7kPaZlnqwEm4itApz7AELoG0BR6e3pOTM1DBnJJ4aTEg8z3Ncv+0e XaIi87Yp11tOyZ67ZIS0mqVBkqEszNRBfKRwuGo1FBaeyFJjFTTgiigHi+f/0bH14BGb p0pg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b="b/Cbxkdd"; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=YZIpr5+w; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=L06fG1oO; 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-40906a118c2si4358671b6e.252.2025.06.09.03.02.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Jun 2025 03:02:35 -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="b/Cbxkdd"; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=YZIpr5+w; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=L06fG1oO; 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=ObZ/Jrv6HTLKho43Q/8wNTTM45k6gTikg3C1NtV61uU=; b=b/CbxkddOjv5dM/huR0vUCdDWk Xbmf0eYPcu7mbUpj6TeDc+Q+9n9zgy5vi+yr7npTdk9Sjg/RKgnu1faTWYDWk+nOk6jOIkhm9HfCL AyztDXnYxu13G3RCKqC2BRvpzsQqTizyjv9uJl7V9qw+pg3edhymY5Ckdt2Ru/a8LuXw=; 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.95) (envelope-from ) id 1uOZKp-0006W9-PG; Mon, 09 Jun 2025 10:02:31 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1uOZKo-0006W2-4z for openvpn-devel@lists.sourceforge.net; Mon, 09 Jun 2025 10:02:30 +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=G6ErPLLtPtvBhIpD+cBm6mpKrQJAa/+AYIVCNPg2Hhk=; b=YZIpr5+wAVF4s57WBegUYA+52c l8O9764hfwwsGP4KUbFf/F2qwCVNynL6ZRKNfdnU6vQmcomQniHc8srz+ZWo/zrsJ0+8yruM6x4HO Jsr+AX9nnNVegNzs4yUGimriLrt0pPrds2XziuIcmIyZvIdRAHVzqeq9XiYTVDrt0sJ4=; 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=G6ErPLLtPtvBhIpD+cBm6mpKrQJAa/+AYIVCNPg2Hhk=; b=L06fG1oOtwoLSJXhUf1BHyDAo2 Dgh7XlZICEKwzVP1K4qsZkHVNRYrfdaMVcgCMhuRf7FmIP60V3J6woK2HRd/Y+9ZqykX8k5Ex2o2T hfYHa/FXJ5GKSnqLrvB86oXchNlhxWRTqNRKpeKNiCabsjGcznljl2j0OKUZ+pSLmyC0=; 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 1uOZKn-0000y4-1S for openvpn-devel@lists.sourceforge.net; Mon, 09 Jun 2025 10:02:30 +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 559A2HOr004016 for ; Mon, 9 Jun 2025 12:02:17 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.17.1.9/8.17.1.9/Submit) id 559A2HYY004015 for openvpn-devel@lists.sourceforge.net; Mon, 9 Jun 2025 12:02:17 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Mon, 9 Jun 2025 12:02:10 +0200 Message-ID: <20250609100216.3997-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 The ovpn netlink code reports more verbose error strings to help userspace understand what went wrong, rather than just returning, for example, -EINVAL. 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: 1uOZKn-0000y4-1S Subject: [Openvpn-devel] [PATCH v2] dco_linux: enable extended netlink error reporting 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?1834445288397184011?= X-GMAIL-MSGID: =?utf-8?q?1834445288397184011?= From: Antonio Quartulli The ovpn netlink code reports more verbose error strings to help userspace understand what went wrong, rather than just returning, for example, -EINVAL. However, userspace must instruct the kernel netlink subsystem that it wants to receive such strings. code for parsing such strings has always been present but it was never used. Set the socket option which enables such reporting. Change-Id: I4457b1d7262e0a39c275d33aaef6c4bcbeae6ab3 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/+/1040 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 49dbdad..0345413 100644 --- a/src/openvpn/dco_linux.c +++ b/src/openvpn/dco_linux.c @@ -367,19 +367,19 @@ { len = strnlen((char *)nla_data(tb_msg[NLMSGERR_ATTR_MSG]), nla_len(tb_msg[NLMSGERR_ATTR_MSG])); - msg(M_WARN, "kernel error: %*s\n", len, + msg(M_WARN, "kernel error: %*s", len, (char *)nla_data(tb_msg[NLMSGERR_ATTR_MSG])); } if (tb_msg[OVPN_NLMSGERR_ATTR_MISS_NEST]) { - msg(M_WARN, "kernel error: missing required nesting type %u\n", + msg(M_WARN, "kernel error: missing required nesting type %u", nla_get_u32(tb_msg[OVPN_NLMSGERR_ATTR_MISS_NEST])); } if (tb_msg[OVPN_NLMSGERR_ATTR_MISS_TYPE]) { - msg(M_WARN, "kernel error: missing required attribute type %u\n", + msg(M_WARN, "kernel error: missing required attribute type %u", nla_get_u32(tb_msg[OVPN_NLMSGERR_ATTR_MISS_TYPE])); } @@ -405,6 +405,11 @@ nl_geterror(ret)); } + /* enable Extended ACK for detailed error reporting */ + ret = 1; + setsockopt(nl_socket_get_fd(dco->nl_sock), SOL_NETLINK, NETLINK_EXT_ACK, + &ret, sizeof(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));