From patchwork Tue Apr 2 13:09:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1918811 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=1jBS646v; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=J5Hm6nMM; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=j2HVJcTB; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V87YJ6FLrz1yZ3 for ; Wed, 3 Apr 2024 00:11:00 +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:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9AN0Vi6VjhhkUQHGy2iGU1l9YU3M5m4084QAwvPidIs=; b=1jBS646vxwiLf4 Pw2PD1YWS7kcVR8Ne8fQ8E2fIZG0mSL6FdGmUglOLY8koYkILDl/DhzgJYh4PO8uVDNJ1E54e8CEU 1uFMmne68j5uWukbBLt42XjICZhGbfJOI6Ggl4d4CtQvHeLfc/iaBuKT8V/A6xxtJtnWL2X22vyQP l0LlR8F9dIVdhiVxVRMozoZ7Y2S+hssWu1Ndv11rfElOllCo41LPyOHEO/9UJ/AKHdrqX1nPpxsZg pGNB/uhr5UfA9BMOcaZB0kZvhwBWCdJ+nPGBk4nSyGYAHUWPuORXWYbUp4eRQoQbJ4Zp/yuYyYRqY 2B7j+T54b8GBLdydDs4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrdtL-0000000BGQ1-44xt; Tue, 02 Apr 2024 13:09:32 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrdtJ-0000000BGOl-1Eib for openwrt-devel@bombadil.infradead.org; Tue, 02 Apr 2024 13:09:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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; bh=t4PAMFsnYdqLhY3133/R/aTcTMYY6xWqHb5MD0Dt37g=; b=J5Hm6nMMUkyLFkvqE6b+9pU4ol k4rd4j2+4K1JaGt7StZ/5ghBRpEyiax8KjQTz55P89ZgVMIFj9VTmNG/XcJZhi2+l0HdjpZ3kPU0W Oz+4PCFD/qM+OBv8xdHLjmepuidFu7kxRgHsbqpBFq5mrXWhOyQ+DHh24moY6BNFx/qu/Rsk/xQmo VM6lRz/tElytfvv/xXN7QWJJ6GZImKxFVGGznm4XeK/C9pbc0ZfJi1ztpiYX7bHrSOJmtmvuFqMrA C+9QnZUx+n5T2+KF75FarAwHtL2va45/QCtuOjTTYnhPbGRXAdmiiIRIASEN9zYilsEoxLNwrAMDQ jH6BbGCA==; Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrdtE-00000003e5h-1isR for openwrt-devel@lists.openwrt.org; Tue, 02 Apr 2024 13:09:27 +0000 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-515b3077d09so5575083e87.1 for ; Tue, 02 Apr 2024 06:09:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712063362; x=1712668162; darn=lists.openwrt.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=t4PAMFsnYdqLhY3133/R/aTcTMYY6xWqHb5MD0Dt37g=; b=j2HVJcTBqXo+SriIN9HUoogOVD4O3WMq/toM/EzPdbRnWDi0MYtxunRZYRLdmaX3FR maFPkkHn/T3CeaYOz8O8h/TCgLxqvDUZl/SxJ/yEB46iaE8eqjfXaTJ8pJmUSX4N5aAO /xQla8dZ4vRR0SH/qaFQNkaHAw48UvU66tjzNTrLPd494x/8tauC5CnyGNyZ1/uLW5Qh YoItredy4CrERj9nMprSrAvaDZ0VA0dUpHrM+82NGJoI3fmaHHY42JFrQsMPaAlyMWZD 3Sb/2NMMHsuJVWmJ/joh13bpWwVSl9cTn3+QkscPzKKStKGUzP2tNTu+SmHwA5DFb2F3 BuMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712063362; x=1712668162; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=t4PAMFsnYdqLhY3133/R/aTcTMYY6xWqHb5MD0Dt37g=; b=vqraUYiehZA9633Kz1j1fQVMD5Ui8s4kSQH4k4ulL/L5h3QtbnyOgOLIc1GeZ6IRvb BpQp6+IEZEuErneMv0a0x7p8U+DF5E4udogJTCN0D6UNOgsUbas3vxwa8ca9jaLTm1KX WrYqjk829gaYzhBUho2sXzES+vo0i7EvU3L0ZKe7ox2jgWTyJLua9mxKtJ8IBJ8FOAiX 5IeHrF42MjZLzrlFTu69yufWR2Ih8fYaRwqrkzxci/06DBw8+K2useAGZabRA2eY+hc4 j1/gu723dfOZ7hG7ImHcYn+TWcnbBR1SbZ/oQIfQbYZPWoKv9yCD3h5kNlyEJn3XBKbU Frag== X-Gm-Message-State: AOJu0Yyp2RVcugIOAAHFl8oULJxwkV7UUhHv5xOcaOYt8QndvGcBfSeo KqimWjq8b4XRj1CQu7nLHDkk+Vmq5n+OnAKYKgSd3UUlFT+usfqziBWlP+81 X-Google-Smtp-Source: AGHT+IFVB0G7eUNdkBGPlyVrlrmsTHonZ/jGOOdMtRth30lmWv3IDypC1/sbV/YermEdDxNx/vi0Gg== X-Received: by 2002:a05:6512:3e12:b0:515:d19b:babc with SMTP id i18-20020a0565123e1200b00515d19bbabcmr12310759lfv.68.1712063362085; Tue, 02 Apr 2024 06:09:22 -0700 (PDT) Received: from blackhol3 ([2001:9b0:40::cae3:cb03]) by smtp.gmail.com with ESMTPSA id m15-20020a056512358f00b005159fa03501sm1704109lfr.302.2024.04.02.06.09.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 06:09:21 -0700 (PDT) From: Paul Donald To: openwrt-devel@lists.openwrt.org Subject: [PATCH 3/5] dnsmasq: add 'extraconftext' parameter Date: Tue, 2 Apr 2024 15:09:17 +0200 Message-ID: <20240402130919.58881-3-newtwen+github@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240402130919.58881-1-newtwen+github@gmail.com> References: <20240402130919.58881-1-newtwen+github@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240402_140924_875512_EC892CD4 X-CRM114-Status: GOOD ( 10.04 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "desiato.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: Users can now freely add new dnsmasq parameters (i.e. a whole config) via extraconf. This means users can add their own parameters without changes to init or GUI. Co-opted the default of confdir also to include the instance name. This way each instance gets its own .d directory (and separate instances do not all inherit the same 'extraconftext'). 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_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:133 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [newtwen+github(at)gmail.com] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Users can now freely add new dnsmasq parameters (i.e. a whole config) via extraconf. This means users can add their own parameters without changes to init or GUI. Co-opted the default of confdir also to include the instance name. This way each instance gets its own .d directory (and separate instances do not all inherit the same 'extraconftext'). See https://forum.openwrt.org/t/add-dnsmasq-custom-options-field-in-luci-gui/193184 Tested on: 23.05.3, 22.03.6 Signed-off-by: Paul Donald --- package/network/services/dnsmasq/files/dnsmasq.init | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init index 9bb334f816..9b98bbb015 100755 --- a/package/network/services/dnsmasq/files/dnsmasq.init +++ b/package/network/services/dnsmasq/files/dnsmasq.init @@ -12,6 +12,7 @@ ADD_WAN_FQDN=0 ADD_LOCAL_FQDN="" BASECONFIGFILE="/var/etc/dnsmasq.conf" +EXTRACONFFILE="extraconfig.conf" BASEHOSTFILE="/tmp/hosts/dhcp" TRUSTANCHORSFILE="/usr/share/dnsmasq/trust-anchors.conf" TIMEVALIDFILE="/var/state/dnsmasqsec" @@ -1118,14 +1119,19 @@ dnsmasq_start() xappend "--dhcp-broadcast=tag:needs-broadcast" - config_get dnsmasqconfdir "$cfg" confdir "/tmp/dnsmasq.d" + # Create a dnsmasq.d dir for each instance + config_get dnsmasqconfdir "$cfg" confdir "/tmp/dnsmasq${cfg:+.$cfg}.d" xappend "--conf-dir=$dnsmasqconfdir" dnsmasqconfdir="${dnsmasqconfdir%%,*}" - [ ! -d "$dnsmasqconfdir" ] && mkdir -p $dnsmasqconfdir + [ ! -d "$dnsmasqconfdir" ] && mkdir -p "$dnsmasqconfdir" xappend "--user=dnsmasq" xappend "--group=dnsmasq" echo >> $CONFIGFILE_TMP + # EXTRACONFFILE allows new dnsmasq parameters before they are natively handled in this init file + config_get extraconftext "$cfg" extraconftext + echo -e "$extraconftext" > "$dnsmasqconfdir"/"$EXTRACONFFILE" + config_get_bool enable_tftp "$cfg" enable_tftp 0 [ "$enable_tftp" -gt 0 ] && { config_get tftp_root "$cfg" tftp_root