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=ir8c0mI2; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 25A6C5A0282 for ; Wed, 21 Aug 2024 06:20:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1724214023; bh=wD2Cdty+kX4NU/dQVXifnYPhD9afiFuT79mRlWNXoaQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ir8c0mI2y6y7UCv5lqLUYfdnEUNTUjju8WRN9oSEpz/gQ4qJbBIbQRTsWKLb/vQ/C Q6mVOQ3ylSwj8sEt/ygnrxAU/gM8I3VaUu0kAfdsA7WT8QJk85LL766YYwm4woKf4w Qh7YKaASzAdBIKO9GFIwLuePyiUyKvNeiRL/2yUHVd/hRdsu+99ei38kmjFyBCaCLZ iVnskkBExiBwa7ISc415QNxbhqhcWo/NlH1+AY91m47T6smursC0b/wmgTZZD84TR9 Z6hh5fCzTp39ujHUz+Q13ulRdTCYkk5rrvfRS2ReXcFyQiGKbqSfAXsL0ev9HcMDqS SMtblk+HmMznA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4WpY5z2CnMz4x8K; Wed, 21 Aug 2024 14:20:23 +1000 (AEST) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v2 09/23] conf: Correct setting of dns_match address in add_dns6() Date: Wed, 21 Aug 2024 14:20:05 +1000 Message-ID: <20240821042020.718422-10-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240821042020.718422-1-david@gibson.dropbear.id.au> References: <20240821042020.718422-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 54IFVFCZ5PEIIL36HWD4OLG6A3L5BDUA X-Message-ID-Hash: 54IFVFCZ5PEIIL36HWD4OLG6A3L5BDUA 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