From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id BAA2C5A0322 for ; Wed, 14 Aug 2024 06:31:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1723609853; bh=RNSpUj2Wv2R2hvzXKIUwgVmQztxIZEyqCfCS/VQOQJk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Aghx4IQ4Z6pzEgerypfitTot/+g1almhNy3H2pWv310LDWEzZzpLNS4gKqUrtuuD0 20wyEGVyYEgSnVFgNoD1rmXP/5ak+8WBM5ho+u5rxdDX8Cf/msVMxBBJZeFXZR2yN1 7iMZ/MFyVwIokQpshozeY5KyJXX+fsDRn5QoClv/6bBfwL56SCv8ChaufRaYwAp0YU 8V+JTn0SWR6GSyXVw6znazuE0dg+OPCXkxv3/zNnCx2Vm7hpMVW1/fmiVdKi1z9FNG EiHrV2YkiLCsUACjboU4MX1M4cbuJzuF99sZ45XLk+mUxfmNo7L0snNzODonlcwiAY Se/mIdiyLAwjA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4WkFgK2ChMz4xD9; Wed, 14 Aug 2024 14:30:53 +1000 (AEST) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH 10/16] conf: Correct setting of dns_match address in add_dns6() Date: Wed, 14 Aug 2024 14:30:44 +1000 Message-ID: <20240814043050.4177037-11-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240814043050.4177037-1-david@gibson.dropbear.id.au> References: <20240814043050.4177037-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: K24L6XG3VKG45SROSGRCZ6JATGMCUGJ7 X-Message-ID-Hash: K24L6XG3VKG45SROSGRCZ6JATGMCUGJ7 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: 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 1b57af71..cb462b09 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