From patchwork Thu Feb 21 03:52:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 1045733 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Rr3bdSg5"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="jMeH/4kl"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 444gYD3yZSz9s5c for ; Thu, 21 Feb 2019 14:53:04 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:Message-Id:Date:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=DvRaT1ycjYp8++cj+z6UNnheyAqvKe32OZnTF7aKv6I=; b=Rr3bdSg5ZUNXu/ q7cOXHZsqgMmO8J1dVDw0kYDe6uisTPgPnEG6CyCcHJm1XzjP4XJpfIVQuXXUi3LPgTObPxRVmQ5b APNRQwSv63QdjJ1Qn9a2YLjRD3VgEuu5tdX5IYFzXYdfhiyG/fowsCQ+fcMR5QPb1K3CNF4Y6ThuI 80T+YIij+mEMBTMe7TJaZtCp00tHrqlmuwqghf6f3sOIvKcHc1CUXv0XpYzCpPx/YOCntoRuaXvNw fAyrSjt317S3buMVErsT667d/j/kLf44fqVsRR6r3GuToUkjvg+rXmzKOLFXlxpY02bbOGlyv3Ha3 sWBUscfGR+s7vLz4udCw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwfPi-0005VD-R1; Thu, 21 Feb 2019 03:52:46 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwfPf-0005Uu-0f for openwrt-devel@lists.openwrt.org; Thu, 21 Feb 2019 03:52:44 +0000 Received: by mail-pg1-x541.google.com with SMTP id u9so9537218pgo.7 for ; Wed, 20 Feb 2019 19:52:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DWvYZpIUUZlkiMehAUf6yzjqrENrJaaNrM4MGB+fLng=; b=jMeH/4klOj6Wgq//FohZlkV+Q3gsdr8BmIDE+eK9sIMkdxTyzywIF1KCjLQTPQ/uWV CTL7wZH/UHU/LXM3yd1gg4sA0g4egtBY5IcerMsjsrQduIChk+kVn8+NQNxmX+JkcN7T +9VInSp1pmdq9962mMy9d2mwiN89lwmJDk1mpYLYie48XeV2P9RXPfPFq2PLFbIhaIjf Dnd6kS1FtKxBejLyRc5LDUlob2P21fHwp3ZccZ49RXwTwK01nrFaGEiL/loeFx7ypcIz wIV/p7Bo+YCJV/FXrxeonZbdrbi9DvcF/e+XxXpIfvjSkBdnNCVsjtBAoax6+CZS42Li 4X9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DWvYZpIUUZlkiMehAUf6yzjqrENrJaaNrM4MGB+fLng=; b=tMg+/ujD5UwUFfTi02VQWOk3RQoYbjTmzELH0XfNjRHCBPOiACxbMr3RVbIMZoTExy k2WfvfRiofvALyy2Si69llDzPNFbJti/ZCfq4OmYAnrPNznXF/NIrSEhuIIYmuHCvuI7 hOjc9Dc/g5SXo72BZJ7M5Y9znrRtNP4+8tmv36jEnVa3MfWcfulu4oBjn97T55Yk9WEU 0xPr+zNBpO0lCn69O0jkdrQWu/IvD/IgUA1IZoOzwaIc3dBHzHhtla+I1uiYU0TU9/nz IuUOMLCLaNgP63+2KcZxDB378zA7ggPkjsIpc+IHsZSjbaA24b+b92rtlnLMrx8DJIqi i5RQ== X-Gm-Message-State: AHQUAuavgMHxPVBtG0MQwDGJCZkkSiIx6sEVnpw6LW5Q552YLREteOtk c/PqK2/kRkwrkl3k8v/U7Z8= X-Google-Smtp-Source: AHgI3IaizGaGeZf+qx4bwz4h/ny0SmeAHwEhjkFva1GuPGe8ks7s26qyzXcP0uHNBtjGbfQid4EEng== X-Received: by 2002:a62:138f:: with SMTP id 15mr38122252pft.219.1550721161832; Wed, 20 Feb 2019 19:52:41 -0800 (PST) Received: from titan.localdomain.hq.cloud.yunionyun.com ([47.52.22.109]) by smtp.gmail.com with ESMTPSA id e24sm28171731pfi.153.2019.02.20.19.52.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Feb 2019 19:52:40 -0800 (PST) From: Yousong Zhou To: dedeckeh@gmail.com, ldir@darbyshire-bryant.me.uk Date: Thu, 21 Feb 2019 03:52:28 +0000 Message-Id: <20190221035228.5145-1-yszhou4tech@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190220_195243_086745_77E13886 X-CRM114-Status: UNSURE ( 8.20 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:541 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (yszhou4tech[at]gmail.com) -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's 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 Subject: [OpenWrt-Devel] [PATCH] dnsmasq: prefer localuse over resolvfile guesswork X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yousong Zhou , openwrt-devel@lists.openwrt.org Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org This makes it clear that localuse when explicitly specified in the config will have its final say on whether or not the initscript should touch /etc/resolv.conf, no matter whatever the result of previous guesswork would be Signed-off-by: Yousong Zhou Tested-by: Paul Oranje --- package/network/services/dnsmasq/Makefile | 2 +- package/network/services/dnsmasq/files/dnsmasq.init | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile index d874296ea7..8c8427f6c1 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.80 PKG_VERSION:=$(subst test,~~test,$(subst rc,~rc,$(PKG_UPSTREAM_VERSION))) -PKG_RELEASE:=9 +PKG_RELEASE:=10 PKG_SOURCE:=$(PKG_NAME)-$(PKG_UPSTREAM_VERSION).tar.xz PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init index f65736e268..4ae71e438b 100644 --- a/package/network/services/dnsmasq/files/dnsmasq.init +++ b/package/network/services/dnsmasq/files/dnsmasq.init @@ -733,7 +733,7 @@ dnsmasq_start() { local cfg="$1" local disabled user_dhcpscript - local resolvfile localuse + local resolvfile localuse=0 config_get_bool disabled "$cfg" disabled 0 [ "$disabled" -gt 0 ] && return 0 @@ -884,13 +884,13 @@ dnsmasq_start() config_get_bool cachelocal "$cfg" cachelocal 1 config_get_bool noresolv "$cfg" noresolv 0 - config_get_bool localuse "$cfg" localuse 0 if [ "$noresolv" != "1" ]; then config_get resolvfile "$cfg" resolvfile /tmp/resolv.conf.auto [ -n "$resolvfile" -a ! -e "$resolvfile" ] && touch "$resolvfile" xappend "--resolv-file=$resolvfile" [ "$resolvfile" = "/tmp/resolv.conf.auto" ] && localuse=1 fi + config_get_bool localuse "$cfg" localuse "$localuse" config_get hostsfile "$cfg" dhcphostsfile [ -e "$hostsfile" ] && xappend "--dhcp-hostsfile=$hostsfile" @@ -1040,13 +1040,13 @@ dnsmasq_start() dnsmasq_stop() { local cfg="$1" - local noresolv resolvfile localuse + local noresolv resolvfile localuse=0 config_get_bool noresolv "$cfg" noresolv 0 - config_get_bool localuse "$cfg" localuse 0 config_get resolvfile "$cfg" "resolvfile" [ "$noresolv" = 0 -a "$resolvfile" = "/tmp/resolv.conf.auto" ] && localuse=1 + config_get_bool localuse "$cfg" localuse "$localuse" [ "$localuse" -gt 0 ] && ln -sf "/tmp/resolv.conf.auto" /tmp/resolv.conf rm -f ${BASEDHCPSTAMPFILE}.${cfg}.*.dhcp