From patchwork Tue Apr 2 13:09:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1918813 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=JYhKWYnm; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=casper.20170209 header.b=XEuEIw4i; 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=J9l+Ry6/; 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 4V87YR3X4mz1yZ3 for ; Wed, 3 Apr 2024 00:11:07 +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=irgmQNlUcMiC37olfTPaizXPUndl8UxYDHd+XSUayYI=; b=JYhKWYnmPYsYI+ xjtsKosFIdqnaJ/BPdthRcFc4iRawYNEwwZGo5j+9Jp5TD1EZ1P62+eJqWyvINCtAUgwi+9JBpyEY 1qyL/ro2gaL3Cn5R2JwNol3SmmAMsp8TpPI0lIO4cID0DTZhmbxTKszowQABJI2Cb5Gpz4MicXr0+ CrChkY6cuNfGdHXLFCEdNg1oo6BFxx5FeW+nKTWLWwsbOuPR8UMHzyf0Z5UkEsk0jx4prnj4+dvEc 79JzQopsgCH8tuDRbrUetk816hriRZHzd9N022E7VrG4hpNljUxfn9zHQBzdHj9xdMs/XxP7tKAom ZLr5eo1ABvBek5PwVczA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrdta-0000000BGYM-3xZn; Tue, 02 Apr 2024 13:09:46 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrdtM-0000000BGQY-2zb0 for openwrt-devel@bombadil.infradead.org; Tue, 02 Apr 2024 13:09:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=8yMl4zstUFRJLIMwU1ftwNA6t9NEd96Am+zBOgiHxwg=; b=XEuEIw4iiEQchI5vxaqXflEXdB 5CBI0HvcL+k6pktYMWnQ4PN2/MbM8UxhgXqQffIFvX3j8/xc9sVAiRQ+tgIRN+GCAHxqIsGRsAlgU YUuO10MbTSX9nmdun2sBmcvsEJ0A2aYrfzffMwuvptERlWwTjuGeZZVON2rtJtBB3uP7gBpn0m5yH lSuSakzP+q5XMLQ1und1oqhID8NucHVSfO17Au1s+WnB+4Zq0FyDJAaXpiz3wKmdSoDgZeo+EPBUe 7aOwdf/Fy3fPZjQhHRlftX8itOI8xrH1uNb1UT9Cr/khZ+m6RQXX6pAKDGUSQv3TlaFbXra2SayNG ++duYrVA==; Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrdtJ-000000036ND-12tr for openwrt-devel@lists.openwrt.org; Tue, 02 Apr 2024 13:09:31 +0000 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-516a97b3139so2118896e87.2 for ; Tue, 02 Apr 2024 06:09:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712063365; x=1712668165; 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=8yMl4zstUFRJLIMwU1ftwNA6t9NEd96Am+zBOgiHxwg=; b=J9l+Ry6//ZkmMdYn7yEdm3urMLhw8KcolaQHwiQeg47gFrB/CX7EZlKzZ+uO8N3AUc GNmkUL37leH1CJ0zaN+XwG26wxNuWbkUbdJhvXLyXrQpthteB/I82sJHYJxg0B2z1Nfc bjc8VqCr11ejyqo0vojkzRetIH8Nr5i3Zr2N49ll/CEtoZfr25I9ih35DI7RDi46tePU 6sJa69Elf72QG31wC1Uo4710cHqm9cX3eKTSyiFxvWfnZTBgowXTRpB2w0Qss8gw+Lxb wLEuIlNrbGg4RhpU9XLrobw963UNncy+NEhihEv9Cznzuf9s3qg0Xv3ST0HYP7MlaYIb KvIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712063365; x=1712668165; 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=8yMl4zstUFRJLIMwU1ftwNA6t9NEd96Am+zBOgiHxwg=; b=jGRH39di+eXxPRILANNgPUso7sxNayD6Vt76G4/vuT5A2vArTB17Vxb0jcWT0tMO6E 5X7jhCzLvFwF5S/sgaG2oOcElv9cwz43vuJnNhAaKR5gFPI0TPQoP+CT9g6V2i+bJNk6 ttdE51S3HBsI5gx44aLZvPMJJOgskhPlzpvOgiA7nj5k9FY7LvEXYG/Xf7Daz97SmotY MFn7gkDShrbuSKObxLHPe5hsIoe52uaFAFY5vT2r7VN4YpddxQoRvFHlNxMIHq2AntVU RBnsz+xfXAPGZms5Xu17e+/bJF9R+/KmmMGhBRGtWUfvQxraMQoV6s+k3duvC6b9qfeZ ND8g== X-Gm-Message-State: AOJu0YwYs4SVR4RZQREHT3/UtFuGhPUzf/bRR/38DU37cNsKHszCOLGO 2Mh4nSqDLE/1WpeCgzGIMesO6zorPyyjgMWUEXWjOC6quKDhumIt6qyWQExu X-Google-Smtp-Source: AGHT+IHt5wW81c16gc+Y4Bga6a/Xbzu6P73+3bmF6PQ21zw02akwk5sHOxmrWIgT3qkRFGlbUhZVag== X-Received: by 2002:a19:7506:0:b0:513:9b6d:ab0e with SMTP id y6-20020a197506000000b005139b6dab0emr7613599lfe.5.1712063362946; 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.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 06:09:22 -0700 (PDT) From: Paul Donald To: openwrt-devel@lists.openwrt.org Subject: [PATCH 5/5] dnsmasq: add handling of `dns-rr` to init script (add arbitrary resource records) Date: Tue, 2 Apr 2024 15:09:19 +0200 Message-ID: <20240402130919.58881-5-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_140929_315079_B5BC8176 X-CRM114-Status: GOOD ( 10.32 ) X-Spam-Score: -2.1 (--) X-Spam-Report: SpamAssassin version 4.0.0 on casper.infradead.org summary: Content analysis details: (-2.1 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_EF Message has a valid DKIM or DK signature from envelope-from 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 -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [newtwen+github(at)gmail.com] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:129 listed in] [list.dnswl.org] 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 Add support for handling of DNS RR (Resource Records) requests, which are needed for the HTTPS Type 65 records, introduced to support the DNS-based Service Discovery (DNS-SD) mechanism for HTTPS services and defined in the RFC 9460 (9.1. Query Names for HTTPS RRs). Ref: https://forum.openwrt.org/t/resolving-query-type-65-to-local-address-for-ios-clients-in-dnsmasq/179504/11 uci config usage: config dns_rr option rrname 'foo.example.com' option rrnumber '65' option hexdata '00' hexdata is optional. Available since dnsmasq 2.62 (for around 12 years at this point). Tested on 22.03.5 Signed-off-by: Paul Donald --- package/network/services/dnsmasq/Makefile | 2 +- .../services/dnsmasq/files/dnsmasq.init | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile index 5224e996a4..0a597c03ce 100644 --- a/package/network/services/dnsmasq/Makefile +++ b/package/network/services/dnsmasq/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dnsmasq PKG_UPSTREAM_VERSION:=2.90 PKG_VERSION:=$(subst test,~~test,$(subst rc,~rc,$(PKG_UPSTREAM_VERSION))) -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_UPSTREAM_VERSION).tar.xz PKG_SOURCE_URL:=https://thekelleys.org.uk/dnsmasq/ diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init index 0b1a71aee4..8936ae7f75 100755 --- a/package/network/services/dnsmasq/files/dnsmasq.init +++ b/package/network/services/dnsmasq/files/dnsmasq.init @@ -788,6 +788,28 @@ dhcp_hostrecord_add() { xappend "--host-record=$record" } +dhcp_dnsrr_add() { + #This adds arbitrary resource record types (of IN class) whose optional data must be hex + local cfg="$1" + local rrname rrnumber hexdata + + config_get rrname "$cfg" rrname + [ -n "$rrname" ] || return 0 + + config_get rrnumber "$cfg" rrnumber + [ -n "$rrnumber" ] && [ "$rrnumber" -gt 0 ] || return 0 + + config_get hexdata "$cfg" hexdata + + # dnsmasq accepts colon XX:XX:.., space XX XX .., or contiguous XXXX.. hex forms or mixtures thereof + if [ -n "${hexdata//[0-9a-fA-F\:\ ]/}" ]; then + # is invalid hex literal + return 1 + fi + + xappend "--dns-rr=${rrname},${rrnumber}${hexdata:+,$hexdata}" +} + dhcp_relay_add() { local cfg="$1" local local_addr server_addr interface @@ -1158,6 +1180,7 @@ dnsmasq_start() config_foreach filter_dnsmasq match dhcp_match_add "$cfg" config_foreach filter_dnsmasq domain dhcp_domain_add "$cfg" config_foreach filter_dnsmasq hostrecord dhcp_hostrecord_add "$cfg" + config_foreach filter_dnsmasq dnsrr dhcp_dnsrr_add "$cfg" [ -n "$BOOT" ] || config_foreach filter_dnsmasq relay dhcp_relay_add "$cfg" echo >> "$CONFIGFILE_TMP"