From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=fail reason="key not found in DNS" header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202312 header.b=TirfVxX1; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 2A93C5A027F for ; Fri, 16 Aug 2024 07:40:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1723786807; bh=wD2Cdty+kX4NU/dQVXifnYPhD9afiFuT79mRlWNXoaQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TirfVxX1Atzpf8bD0XhJfE9eLI6g/X2nPPUXSRKaYDer/8FEptDNhP8/vJgIHPrZ0 w2JnG0NYQ7xJZ4aRkUWu6sXwntBHDXaJI70JS8SoJ0QSa+7dxpBbH1yFET7QHJCKOF 3n0Do59mO4wyFXHVmdHTY5wSStFD60btpy8MRg933qXftIG5yoD8s46/wU8YQ2kMj8 TzIcLit9ThpqSlxCG5JZdNqUDfCFakJCsg7qSE+FWEc48JL2b2ymF2qwc73MgwyzI9 vR29oA4aRzfpL1f/0bz0llJVvRjL83668n4yJmTngGPGoQk+ljK2ZtTD2fy0IAgpmR nNSGO/bObBrXA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4WlW6H0WHsz4x42; Fri, 16 Aug 2024 15:40:07 +1000 (AEST) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH 09/22] conf: Correct setting of dns_match address in add_dns6() Date: Fri, 16 Aug 2024 15:39:50 +1000 Message-ID: <20240816054004.1335006-10-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240816054004.1335006-1-david@gibson.dropbear.id.au> References: <20240816054004.1335006-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: SNZJ3AWFNNJNB7RL3QZXLULYELY3TU5C X-Message-ID-Hash: SNZJ3AWFNNJNB7RL3QZXLULYELY3TU5C X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Paul Holzinger , David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: add_dns6() (but not add_dns4()) has a bug setting dns_match: it sets it to the given address, rather than the gateway address. This is doubly wrong: - We've just established the given address is a host loopback address the guest can't access - We've just set ip6.dns[] to tell the guest to use the gateway address, so it won't use the dns_match address we're setting Correct this to use the gateway address, like IPv4. Signed-off-by: David Gibson --- conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf.c b/conf.c index 4bb06b78..bf61c143 100644 --- a/conf.c +++ b/conf.c @@ -408,7 +408,7 @@ static unsigned add_dns6(struct ctx *c, struct in6_addr *addr, unsigned idx) added++; if (IN6_IS_ADDR_UNSPECIFIED(&c->ip6.dns_match)) - c->ip6.dns_match = *addr; + c->ip6.dns_match = c->ip6.gw; } } else { c->ip6.dns[idx] = *addr; -- 2.46.0