From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by passt.top (Postfix, from userid 1000) id 45D195A026B; Thu, 23 Feb 2023 18:08:00 +0100 (CET) From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH 1/3] udp: Actually use host resolver to forward DNS queries Date: Thu, 23 Feb 2023 18:07:58 +0100 Message-Id: <20230223170800.3888094-2-sbrivio@redhat.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230223170800.3888094-1-sbrivio@redhat.com> References: <20230223170800.3888094-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: TGX5GZVEVD2UIOBDJM4QHYMMQCD2KOZ3 X-Message-ID-Hash: TGX5GZVEVD2UIOBDJM4QHYMMQCD2KOZ3 X-MailFrom: sbrivio@passt.top 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: Andrea Bolognani 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: Instead of the address of the first resolver we advertise to the guest or namespace. This was one of the intentions behind commit 3a2afde87dd1 ("conf, udp: Drop mostly duplicated dns_send arrays, rename related fields"), but I forgot to implement this part. In practice, they are usually the same thing, unless /etc/resolv.conf points to a loopback address. Fixes: 3a2afde87dd1 ("conf, udp: Drop mostly duplicated dns_send arrays, rename related fields") Signed-off-by: Stefano Brivio --- udp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udp.c b/udp.c index c913d27..1d65559 100644 --- a/udp.c +++ b/udp.c @@ -867,7 +867,7 @@ int udp_tap_handler(struct ctx *c, int af, const void *addr, } else if (IN4_ARE_ADDR_EQUAL(&s_in.sin_addr, &c->ip4.dns_match) && ntohs(s_in.sin_port) == 53) { - s_in.sin_addr = c->ip4.dns[0]; + s_in.sin_addr = c->ip4.dns_host; } } else { s_in6 = (struct sockaddr_in6) { @@ -890,7 +890,7 @@ int udp_tap_handler(struct ctx *c, int af, const void *addr, s_in6.sin6_addr = c->ip6.addr_seen; } else if (IN6_ARE_ADDR_EQUAL(addr, &c->ip6.dns_match) && ntohs(s_in6.sin6_port) == 53) { - s_in6.sin6_addr = c->ip6.dns[0]; + s_in6.sin6_addr = c->ip6.dns_host; } else if (IN6_IS_ADDR_LINKLOCAL(&s_in6.sin6_addr)) { bind_addr = &c->ip6.addr_ll; } -- 2.39.1