public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Jon Maloy <jmaloy@redhat.com>
To: Aditya Merchant <adityamerchant08@gmail.com>, passt-dev@passt.top
Cc: Stefano Brivio <sbrivio@redhat.com>,
	David Gibson <david@gibson.dropbear.id.au>,
	Paul Holzinger <pholzing@redhat.com>,
	Laurent Vivier <lvivier@redhat.com>
Subject: Re: [PATCH 2/3] conf: Forget host nameserver once it's removed from resolv.conf
Date: Fri, 4 Dec 2026 17:15:24 -0500	[thread overview]
Message-ID: <d984905f-8752-4c96-a6bd-76c47c3c8fdf@redhat.com> (raw)
In-Reply-To: <20261204073119.31027-3-adityamerchant08@gmail.com>



On 2026-12-04 02:31, Aditya Merchant wrote:
> When we follow changes to resolv.conf, and it doesn't list a nameserver
> for an IP version anymore, conf_resolv_update() keeps the one we had
> before, and we keep redirecting DNS queries to it.
> 
> That's not what we do at start-up, where get_dns() leaves .dns_host
> unspecified if there's no nameserver for that IP version, and it's
> probably not what users expect either: a nameserver might have been
> removed for a reason. Clear .dns_host in that case, so that we stop
> redirecting DNS queries for that IP version, until a nameserver is
> listed again.

The logic looks right to me. One thing that might be worth spelling
out, though: clearing .dns_host doesn't make queries to the
--dns-forward address fail, it just stops redirecting them, so they
go through nat_outbound() like any other packet. If that address is
the --map-host-loopback one, as we set it up by default when the host
uses a local resolver, they now go to the host's 127.0.0.1:53.
If we have an explicit --dns-forward address, they're sent to that
address as such, and will usually time out.
This is consistent with starting without a nameserver, but it is actually
a visible change for a running instance.
Maybe this should be mentioned in the commit message?

> 
> Extend the dns_host_follow test to check this. As that takes a few more
> steps, keep pasta running until a file shows up, instead of for a fixed
> time, which could end before the last step.
> 
> Suggested-by: Stefano Brivio <sbrivio@redhat.com>
> Link: https://archives.passt.top/passt-dev/20261130013439.0a40738a@elisabeth/
> Signed-off-by: Aditya Merchant <adityamerchant08@gmail.com>
> ---
>   conf.c                             | 14 ++++++++++++++
[...]
>   
>   passt	unshare -rUm
>   passt	mkdir -p __DIR__/upper __DIR__/work
>   passt	mount -t overlay -o lowerdir=/etc,upperdir=__DIR__/upper,workdir=__DIR__/work none /etc
>   passt	echo "nameserver 192.0.2.1" > /etc/r && mv /etc/r /etc/resolv.conf
> -passt	./pasta -d -l __LOG_FILE__ --dns-forward 192.0.2.53 -- sleep 3 2>/dev/null &
> +passt	./pasta -d -l __LOG_FILE__ --dns-forward 192.0.2.53 -- sh -c 'while [ ! -e __DONE__ ]; do sleep 0.1; done' 2>/dev/null &

Clearly better than the fixed sleep.

>   sleep	1
>   passt	echo "nameserver 192.0.2.2" > /etc/r && mv /etc/r /etc/resolv.conf
>   sleep	1
>   check	grep -q "new host nameserver 192.0.2.2" __LOG_FILE__
> -passt	wait
> +
> +test	Host nameserver removed from resolv.conf is forgotten
> +passt	echo "nameserver 2001:db8::1" > /etc/r && mv /etc/r /etc/resolv.conf
> +sleep	1
> +passt	touch __DONE__ && wait
> +check	grep -q "removed nameserver 192.0.2.2" __LOG_FILE__
>   passt	umount /etc
>   passt	exit

Reviewed-by: Jon Maloy <jmaloy@redhat.com>

  reply	other threads:[~2026-12-04 22:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  7:31 [PATCH 0/3] DNS forwarding: follow nameserver changes in passt mode too Aditya Merchant
2026-12-04  7:31 ` [PATCH 1/3] passt.1: Say plainly which nameserver new DNS flows go to Aditya Merchant
2026-12-04 21:35   ` Jon Maloy
2026-12-04  7:31 ` [PATCH 2/3] conf: Forget host nameserver once it's removed from resolv.conf Aditya Merchant
2026-12-04 22:15   ` Jon Maloy [this message]
2026-12-04 22:36     ` Stefano Brivio
2026-12-04  7:31 ` [PATCH 3/3] conf: Follow changes to the host nameserver in passt mode, too Aditya Merchant
2026-12-04 22:31 ` [PATCH 0/3] DNS forwarding: follow nameserver changes in passt mode too Stefano Brivio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d984905f-8752-4c96-a6bd-76c47c3c8fdf@redhat.com \
    --to=jmaloy@redhat.com \
    --cc=adityamerchant08@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=lvivier@redhat.com \
    --cc=passt-dev@passt.top \
    --cc=pholzing@redhat.com \
    --cc=sbrivio@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).