From patchwork Wed Jul 30 18:04:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4341 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:b86:b0:671:5a2c:6455 with SMTP id mw6csp1070205mab; Wed, 30 Jul 2025 11:05:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV1GUUiPz9gc2VVBY2Kl3MNMtNpWp4k/jFAFJ+7YAwk9aFAwcwsB5K3kqzhaJ45WXd9VemYgdA9/hA=@openvpn.net X-Google-Smtp-Source: AGHT+IG8+ZgE8hMB1Q5f9GJkXRg+BQsL45HqWfbjOoy59PPDy3cAGOx5HoxdLtwQHVhm1fskyGcS X-Received: by 2002:a05:6808:1b0e:b0:40a:526e:5e7a with SMTP id 5614622812f47-4319b630d46mr2807204b6e.23.1753898745085; Wed, 30 Jul 2025 11:05:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1753898745; cv=none; d=google.com; s=arc-20240605; b=K1q2qB/gRmXdTCyE/BOcOfbtT2QxYmGr1gxJZdFeylFoSt/y5KNCobXx2sIeCgjQCj cKWP0dGQ7rEKKL+or1rJwUHmeTxcxtfUqRhYIcY6xd9if6YSUsoRVzwGgBwWMUxWcReg PqKBYqgt65WkZxhTnkG/KL44KWp0GuVMHjomcbOlhQ560SqArk7qO2kQ4Wx95I/Kxb/r Q7rnA8p7lygFk764VKzwvrEL6npLt2omPzrFyLeyKjpm7VKVFp9BhHF/IzDm4oSiVvxa U9IZJVbM+Ao3wcGlD6BUWCNY3frA7uaXzU9kqbqh+Z7JFF1qHBwBk4gpu3CGvenmZ+zc IBmQ== 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=OIpmcs4od6CleCP1W9uwkmB4y4L1mZNC2D5MH+vbAVc=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=Y1vHf+xmuUHhqvC6VKGBvTUuiT1nWiux7RknzEtLDV1kE3oIvqGc5b9CYQoiMozIuS rgxLsJEfk4VTFLtjvTM/LU00FiHwlL2/mnkoFom815XqT58tbAlgy+hliHgsTNQ9kNYN jvgy5QiNrNHLUag/qyYGoaW7RIowkWDHnZ0+XkVBMfhDCvHh2FbjzyXvqdYAW7sm8SW8 P4EduAZBbh61oVFSomIdwRVTvFxGCQKxs4TVAQpfwz6gr25W7AgW7OP0g1nG5zc+82Cn Nglv3IBVxtLF+Qkabnsj/qLgVot37uBje5Y8OcrIjVylQVAk7UMJUpXBucB3m4g5YEtr ERKw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=h4OTYoSq; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=AfLIywtv; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=CtApxiat; 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-42c7c6f438csi3681071b6e.29.2025.07.30.11.05.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Jul 2025 11:05:44 -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=h4OTYoSq; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=AfLIywtv; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=CtApxiat; 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=OIpmcs4od6CleCP1W9uwkmB4y4L1mZNC2D5MH+vbAVc=; b=h4OTYoSqAlp9MslpeuD7D5Aeu9 c+ibNE7MF+yqI3kcC+dAmLCSd3fYVj099aU6/L3VtiFG2rAvMl2DpucKOAxUwZ6e243wpAuY395PN QqlqdOnV7F3p3DUMKo8uZbkkh/B8B+N+Qgga8Jcl1j5db1N7vvTiE/mctKCKTnC6x1xQ=; Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1uhBBN-00043k-Ef; Wed, 30 Jul 2025 18:05:41 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1uhBBM-00043e-QL for openvpn-devel@lists.sourceforge.net; Wed, 30 Jul 2025 18:05:40 +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=ZZTOIwFPHKAKsPK8qfaR/G1E73Eandksa6AsYt9/m/A=; b=AfLIywtvL2Bba/81ZOrHkq3aQK hBr4zI4OxRRROjWBR/mrd2RB0YEIlgG4vdfKXw+CmP+o7OO6AF3Gm43/7j6fcEF4A7hTVJjLi69EC YS5KsEwvk1e9PGvKDTk8yExoaYgYvx0GfFDcDwBgV7/Btk9vD7Q8r1zXEOVtI+x0T5Xw=; 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=ZZTOIwFPHKAKsPK8qfaR/G1E73Eandksa6AsYt9/m/A=; b=CtApxiat/mncdUd677ozzbvi+W siPAMTWwKcUwAUOCAHO/npASIfNMosQMrAd9Xky+Pl2S52QLBb6bHvap+J0CRd/haYAYDyZ1DcIsD Mx5KiYt4tw1aqOKQJxWYJrQ0FmJv1OqCYiB1nl6A/kdPT0SAswtbdFZ+6VPHKhLQg16U=; 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 1uhBBL-0004el-KL for openvpn-devel@lists.sourceforge.net; Wed, 30 Jul 2025 18:05:40 +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 56UI5Rdu025585 for ; Wed, 30 Jul 2025 20:05:27 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.17.1.9/8.17.1.9/Submit) id 56UI5RQS025584 for openvpn-devel@lists.sourceforge.net; Wed, 30 Jul 2025 20:05:27 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Wed, 30 Jul 2025 20:04:26 +0200 Message-ID: <20250730180527.25339-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-2.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: Lev Stipakov Commit 2dfc4f ("dns: deal with --dhcp-options when --dns is active") 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: 1uhBBL-0004el-KL Subject: [Openvpn-devel] [PATCH v1] Fix broken DHCP options 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?1839096130587453940?= X-GMAIL-MSGID: =?utf-8?q?1839096130587453940?= From: Lev Stipakov Commit 2dfc4f ("dns: deal with --dhcp-options when --dns is active") broke support for --dhcp-options. It removed the setting of the DHCP_OPTIONS_DHCP_OPTIONAL flag for some DHCP options. This flag is required for those options to be applied correctly, as it is used when building the DHCP options string that is passed to the TAP driver. This commit fixes the issue by restoring the setting of this flag. GitHub: fixes OpenVPN/openvpn#791 Change-Id: I0d75efcceb826d06e74abd003d5377468ff9fe3b Signed-off-by: Lev Stipakov 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/+/1090 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 0662b49..4ba9243 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -8310,9 +8310,12 @@ #endif VERIFY_PERMISSION(OPT_P_DHCPDNS); + bool dhcp_optional = false; + if ((streq(p[1], "DOMAIN") || streq(p[1], "ADAPTER_DOMAIN_SUFFIX")) && p[2] && !p[3]) { dhcp->domain = p[2]; + dhcp_optional = true; } else if (streq(p[1], "DOMAIN-SEARCH") && p[2] && !p[3]) { @@ -8325,6 +8328,7 @@ msg(msglevel, "--dhcp-option %s: maximum of %d search entries can be specified", p[1], N_SEARCH_LIST_LEN); } + dhcp_optional = true; } else if ((streq(p[1], "DNS") || streq(p[1], "DNS6")) && p[2] && !p[3] && (!strstr(p[2], ":") || ipv6_addr_safe(p[2]))) @@ -8336,6 +8340,7 @@ else { dhcp_option_address_parse("DNS", p[2], dhcp->dns, &dhcp->dns_len, msglevel); + dhcp_optional = true; } } #if defined(_WIN32) || defined(TARGET_ANDROID) @@ -8359,6 +8364,7 @@ else if (streq(p[1], "WINS") && p[2] && !p[3]) { dhcp_option_address_parse("WINS", p[2], o->wins, &o->wins_len, msglevel); + o->dhcp_options |= DHCP_OPTIONS_DHCP_OPTIONAL; } else if (streq(p[1], "NTP") && p[2] && !p[3]) { @@ -8390,6 +8396,13 @@ #else /* if defined(_WIN32) || defined(TARGET_ANDROID) */ setenv_foreign_option(options, (const char **)p, 3, es); #endif /* if defined(_WIN32) || defined(TARGET_ANDROID) */ + + if (dhcp_optional) + { +#if defined(_WIN32) || defined(TARGET_ANDROID) + o->dhcp_options |= DHCP_OPTIONS_DHCP_OPTIONAL; +#endif + } } #ifdef _WIN32 else if (streq(p[0], "show-adapters") && !p[1])