* [PATCH 0/3] DNS forwarding: follow nameserver changes in passt mode too
@ 2026-12-04 7:31 Aditya Merchant
2026-12-04 7:31 ` [PATCH 1/3] passt.1: Say plainly which nameserver new DNS flows go to Aditya Merchant
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Aditya Merchant @ 2026-12-04 7:31 UTC (permalink / raw)
To: passt-dev; +Cc: Stefano Brivio, David Gibson, Paul Holzinger, Laurent Vivier
These are the follow-ups Stefano suggested after applying "conf: Follow
changes to the host nameserver used for DNS forwarding":
- 1/3 rewords the passt.1 sentence that was hard to read
- 2/3 forgets a nameserver once resolv.conf doesn't list one for that IP
version anymore, as we do at start-up
- 3/3 follows changes in passt mode too, which needs openat() in passt's
seccomp profile (34 to 35 syscalls on x86_64, pasta stays at 43)
Tested on Kali (arm64, Linux 7.1) with the AppArmor profiles enforcing,
using a small script that acts as a guest on passt's socket and sends
DNS queries to the --dns-forward address. In passt mode, new queries
reach the new nameserver after resolv.conf is replaced by rename,
rewritten in place, filled in after starting without a nameserver, or
replaced through a link into /run/resolvconf. With --dns-host, the
address stays fixed. Once the nameserver is removed, queries aren't
redirected anymore, and they are again once one is listed. Without the
AppArmor rule that 3/3 moves to the passt abstraction, passt can't read
resolv.conf under /run. pasta behaves as before, except that it now
forgets a removed nameserver as well. The extended test passes, and its
new cases fail on current master. 'make cppcheck' and 'make clang-tidy'
pass.
The SELinux modules build against Fedora 45's policy, but I couldn't try
them with SELinux enforcing.
Aditya Merchant (3):
passt.1: Say plainly which nameserver new DNS flows go to
conf: Forget host nameserver once it's removed from resolv.conf
conf: Follow changes to the host nameserver in passt mode, too
README.md | 2 +-
conf.c | 19 +++++++++++++++----
contrib/apparmor/abstractions/passt | 4 ++++
contrib/apparmor/abstractions/pasta | 4 ----
contrib/selinux/passt.te | 4 ++++
passt.1 | 6 +++---
test/pasta_options/dns_host_follow | 23 +++++++++++++++++++++--
7 files changed, 48 insertions(+), 14 deletions(-)
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3] passt.1: Say plainly which nameserver new DNS flows go to
2026-12-04 7:31 [PATCH 0/3] DNS forwarding: follow nameserver changes in passt mode too Aditya Merchant
@ 2026-12-04 7:31 ` 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
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Aditya Merchant @ 2026-12-04 7:31 UTC (permalink / raw)
To: passt-dev; +Cc: Stefano Brivio, David Gibson, Paul Holzinger, Laurent Vivier
Once resolv.conf changes, the description of --dns-host says that new
DNS flows go to "its current first nameserver of the same IP version".
It's not obvious that "its" refers to resolv.conf, and, if it does, it
doesn't add anything. Say that they go to the first nameserver listed
for each IP version instead.
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>
---
passt.1 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/passt.1 b/passt.1
index b3c0479..c743889 100644
--- a/passt.1
+++ b/passt.1
@@ -288,8 +288,8 @@ Configure the host nameserver which guest or namespace queries to the
be specified zero to two times (once for IPv4, once for IPv6).
By default, the first nameserver from the host's
\fI/etc/resolv.conf\fR. In pasta mode, on Linux 5.12 or later, this
-default follows changes to that file: new DNS flows go to its current
-first nameserver of the same IP version, while existing flows keep their
+default follows changes to that file: new DNS flows go to the first
+nameserver listed for each IP version, while existing flows keep their
target until they expire.
.TP
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/3] conf: Forget host nameserver once it's removed from resolv.conf
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 7:31 ` Aditya Merchant
2026-12-04 22:15 ` Jon Maloy
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
3 siblings, 1 reply; 8+ messages in thread
From: Aditya Merchant @ 2026-12-04 7:31 UTC (permalink / raw)
To: passt-dev; +Cc: Stefano Brivio, David Gibson, Paul Holzinger, Laurent Vivier
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.
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 ++++++++++++++
test/pasta_options/dns_host_follow | 10 ++++++++--
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/conf.c b/conf.c
index d3976d3..7a271ff 100644
--- a/conf.c
+++ b/conf.c
@@ -352,11 +352,20 @@ static int conf_resolv_update(struct ctx *c)
}
close(fd);
+ /* If resolv.conf doesn't list a nameserver for an IP version anymore,
+ * forget the one we had, as if we started now: we don't redirect DNS
+ * queries for that IP version until a nameserver shows up again
+ */
if (c->ip4.dns_host_resolv && found4 &&
!IN4_ARE_ADDR_EQUAL(&ns4, &c->ip4.dns_host)) {
c->ip4.dns_host = ns4;
info("Forwarding DNS queries to new host nameserver %s",
inet_ntop(AF_INET, &ns4, addr, sizeof(addr)));
+ } else if (c->ip4.dns_host_resolv && !found4 &&
+ !IN4_IS_ADDR_UNSPECIFIED(&c->ip4.dns_host)) {
+ info("Stopped forwarding DNS queries to removed nameserver %s",
+ inet_ntop(AF_INET, &c->ip4.dns_host, addr, sizeof(addr)));
+ c->ip4.dns_host = in4addr_any;
}
if (c->ip6.dns_host_resolv && found6 &&
@@ -364,6 +373,11 @@ static int conf_resolv_update(struct ctx *c)
c->ip6.dns_host = ns6;
info("Forwarding DNS queries to new host nameserver %s",
inet_ntop(AF_INET6, &ns6, addr, sizeof(addr)));
+ } else if (c->ip6.dns_host_resolv && !found6 &&
+ !IN6_IS_ADDR_UNSPECIFIED(&c->ip6.dns_host)) {
+ info("Stopped forwarding DNS queries to removed nameserver %s",
+ inet_ntop(AF_INET6, &c->ip6.dns_host, addr, sizeof(addr)));
+ c->ip6.dns_host = in6addr_any;
}
return 0;
diff --git a/test/pasta_options/dns_host_follow b/test/pasta_options/dns_host_follow
index 2d7ac6d..d8cc232 100644
--- a/test/pasta_options/dns_host_follow
+++ b/test/pasta_options/dns_host_follow
@@ -13,16 +13,22 @@ htools unshare mount grep
test Host nameserver follows changes to resolv.conf
set DIR __STATEDIR__/resolv
set LOG_FILE __STATEDIR__/resolv.log
+set DONE __STATEDIR__/resolv.done
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 &
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
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/3] conf: Follow changes to the host nameserver in passt mode, too
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 7:31 ` [PATCH 2/3] conf: Forget host nameserver once it's removed from resolv.conf Aditya Merchant
@ 2026-12-04 7:31 ` Aditya Merchant
2026-12-04 22:31 ` [PATCH 0/3] DNS forwarding: follow nameserver changes in passt mode too Stefano Brivio
3 siblings, 0 replies; 8+ messages in thread
From: Aditya Merchant @ 2026-12-04 7:31 UTC (permalink / raw)
To: passt-dev; +Cc: Stefano Brivio, David Gibson, Paul Holzinger, Laurent Vivier
We follow changes to the host's resolv.conf in pasta mode only, as
passt doesn't allow openat() in its seccomp profile. But guests using
--dns-forward are affected just like containers: once the host switches
to another network, or connects to a VPN, their DNS queries keep going
to a stale nameserver until passt restarts.
Allow openat() for passt, too, and drop the check on the mode. We only
use it to open resolv.conf through the read-only, detached copy of its
directory: everything else conf_resolv_watch() needs happens before we
apply seccomp filters, and, once we're sandboxed, there's nothing else
we could open by path anyway. This brings passt to 35 allowed system
calls on x86_64.
Move the AppArmor rule for resolv.conf under /run from the pasta
abstraction to the passt one, which pasta includes, and let passt watch
the same directories as pasta with SELinux.
Extend the dns_host_follow test to check that passt, without a guest,
picks up a new nameserver and forgets a removed one.
Suggested-by: Stefano Brivio <sbrivio@redhat.com>
Link: https://archives.passt.top/passt-dev/20261130013444.57add0dc@elisabeth/
Link: https://archives.passt.top/passt-dev/20261130013439.0a40738a@elisabeth/
Signed-off-by: Aditya Merchant <adityamerchant08@gmail.com>
---
README.md | 2 +-
conf.c | 5 +----
contrib/apparmor/abstractions/passt | 4 ++++
contrib/apparmor/abstractions/pasta | 4 ----
contrib/selinux/passt.te | 4 ++++
passt.1 | 2 +-
test/pasta_options/dns_host_follow | 13 +++++++++++++
7 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/README.md b/README.md
index 43caf49..2f865fc 100644
--- a/README.md
+++ b/README.md
@@ -291,7 +291,7 @@ speeding up local connections, and usually requiring NAT. _pasta_:
* ✅ all capabilities dropped, other than `CAP_NET_BIND_SERVICE` (if granted)
* ✅ with default options, user, mount, IPC, UTS, PID namespaces are detached
* ✅ no external dependencies (other than a standard C library)
-* ✅ restrictive seccomp profiles (34 syscalls allowed for _passt_, 43 for
+* ✅ restrictive seccomp profiles (35 syscalls allowed for _passt_, 43 for
_pasta_ on x86_64)
* ✅ examples of [AppArmor](/passt/tree/contrib/apparmor) and
[SELinux](/passt/tree/contrib/selinux) profiles available
diff --git a/conf.c b/conf.c
index 7a271ff..925b94d 100644
--- a/conf.c
+++ b/conf.c
@@ -322,7 +322,7 @@ out:
*
* Return: 0 on success, negative error code if the file can't be opened
*
- * #syscalls:pasta openat
+ * #syscalls openat
*/
static int conf_resolv_update(struct ctx *c)
{
@@ -413,9 +413,6 @@ void conf_resolv_watch(struct ctx *c)
char dir[PATH_MAX], *base;
int fd = -1, dir_fd, rc;
- if (c->mode != MODE_PASTA)
- return;
-
if (IN4_IS_ADDR_UNSPECIFIED(&c->ip4.dns_match))
c->ip4.dns_host_resolv = false;
if (IN6_IS_ADDR_UNSPECIFIED(&c->ip6.dns_match))
diff --git a/contrib/apparmor/abstractions/passt b/contrib/apparmor/abstractions/passt
index 0aeb19d..d4a65a0 100644
--- a/contrib/apparmor/abstractions/passt
+++ b/contrib/apparmor/abstractions/passt
@@ -17,6 +17,10 @@
include <abstractions/nameservice> # get_dns(), conf.c
+ # Host's resolv.conf in /run, read via a detached copy of its directory,
+ # with paths relative to /run: conf_resolv_watch(), conf_resolv_update()
+ /{NetworkManager,connman,netconfig,resolvconf,systemd/resolve}/resolv.conf r,
+
capability net_bind_service, # isolation.c, conf.c
capability setuid,
capability setgid,
diff --git a/contrib/apparmor/abstractions/pasta b/contrib/apparmor/abstractions/pasta
index 7ee892b..89fa427 100644
--- a/contrib/apparmor/abstractions/pasta
+++ b/contrib/apparmor/abstractions/pasta
@@ -29,10 +29,6 @@
@{run}/user/@{uid}/** rw, # pasta_open_ns()
- # Host's resolv.conf in /run, read via a detached copy of its directory,
- # with paths relative to /run: conf_resolv_watch(), conf_resolv_update()
- /{NetworkManager,connman,netconfig,resolvconf,systemd/resolve}/resolv.conf r,
-
@{PROC}/[0-9]*/ns/ r, # pasta_netns_quit_init(),
@{PROC}/[0-9]*/ns/net r, # pasta_wait_for_ns(),
@{PROC}/[0-9]*/ns/user r, # conf_pasta_ns()
diff --git a/contrib/selinux/passt.te b/contrib/selinux/passt.te
index e540473..f2628ec 100644
--- a/contrib/selinux/passt.te
+++ b/contrib/selinux/passt.te
@@ -131,6 +131,10 @@ corenet_tcp_sendrecv_all_ports(passt_t)
corenet_udp_sendrecv_all_ports(passt_t)
sysnet_read_config(passt_t)
+# Watch the directory holding resolv.conf for changes: conf_resolv_watch()
+files_watch_etc_dirs(passt_t)
+networkmanager_watch_pid_dirs(passt_t)
+systemd_resolved_watch_pid_dirs(passt_t)
allow passt_t node_t:icmp_socket { name_bind node_bind };
allow passt_t port_t:icmp_socket name_bind;
diff --git a/passt.1 b/passt.1
index c743889..bf7a95b 100644
--- a/passt.1
+++ b/passt.1
@@ -287,7 +287,7 @@ Configure the host nameserver which guest or namespace queries to the
\fB\-\-dns-forward\fR address will be redirected to. This option can
be specified zero to two times (once for IPv4, once for IPv6).
By default, the first nameserver from the host's
-\fI/etc/resolv.conf\fR. In pasta mode, on Linux 5.12 or later, this
+\fI/etc/resolv.conf\fR. On Linux 5.12 or later, this
default follows changes to that file: new DNS flows go to the first
nameserver listed for each IP version, while existing flows keep their
target until they expire.
diff --git a/test/pasta_options/dns_host_follow b/test/pasta_options/dns_host_follow
index d8cc232..fa8228f 100644
--- a/test/pasta_options/dns_host_follow
+++ b/test/pasta_options/dns_host_follow
@@ -30,5 +30,18 @@ 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__
+
+test Host nameserver follows changes to resolv.conf in passt mode
+set PASST_LOG __STATEDIR__/resolv_passt.log
+set PIDFILE __STATEDIR__/resolv_passt.pid
+passt echo "nameserver 192.0.2.1" > /etc/r && mv /etc/r /etc/resolv.conf
+passt ./passt -d -l __PASST_LOG__ -P __PIDFILE__ -s __STATEDIR__/resolv.sock --dns-forward 192.0.2.53
+passt echo "nameserver 192.0.2.2" > /etc/r && mv /etc/r /etc/resolv.conf
+sleep 1
+passt echo "nameserver 2001:db8::1" > /etc/r && mv /etc/r /etc/resolv.conf
+sleep 1
+passt kill $(cat __PIDFILE__)
passt umount /etc
passt exit
+check grep -q "new host nameserver 192.0.2.2" __PASST_LOG__
+check grep -q "removed nameserver 192.0.2.2" __PASST_LOG__
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] passt.1: Say plainly which nameserver new DNS flows go to
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
0 siblings, 0 replies; 8+ messages in thread
From: Jon Maloy @ 2026-12-04 21:35 UTC (permalink / raw)
To: Aditya Merchant, passt-dev
Cc: Stefano Brivio, David Gibson, Paul Holzinger, Laurent Vivier
On 2026-12-04 02:31, Aditya Merchant wrote:
> Once resolv.conf changes, the description of --dns-host says that new
> DNS flows go to "its current first nameserver of the same IP version".
> It's not obvious that "its" refers to resolv.conf, and, if it does, it
> doesn't add anything. Say that they go to the first nameserver listed
> for each IP version instead.
>
> 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>
> ---
> passt.1 | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/passt.1 b/passt.1
> index b3c0479..c743889 100644
> --- a/passt.1
> +++ b/passt.1
> @@ -288,8 +288,8 @@ Configure the host nameserver which guest or namespace queries to the
> be specified zero to two times (once for IPv4, once for IPv6).
> By default, the first nameserver from the host's
> \fI/etc/resolv.conf\fR. In pasta mode, on Linux 5.12 or later, this
> -default follows changes to that file: new DNS flows go to its current
> -first nameserver of the same IP version, while existing flows keep their
> +default follows changes to that file: new DNS flows go to the first
> +nameserver listed for each IP version, while existing flows keep their
> target until they expire.
>
> .TP
Reviewed-by: Jon Maloy <jmaloy@redhat.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] conf: Forget host nameserver once it's removed from resolv.conf
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
2026-12-04 22:36 ` Stefano Brivio
0 siblings, 1 reply; 8+ messages in thread
From: Jon Maloy @ 2026-12-04 22:15 UTC (permalink / raw)
To: Aditya Merchant, passt-dev
Cc: Stefano Brivio, David Gibson, Paul Holzinger, Laurent Vivier
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>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/3] DNS forwarding: follow nameserver changes in passt mode too
2026-12-04 7:31 [PATCH 0/3] DNS forwarding: follow nameserver changes in passt mode too Aditya Merchant
` (2 preceding siblings ...)
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 ` Stefano Brivio
3 siblings, 0 replies; 8+ messages in thread
From: Stefano Brivio @ 2026-12-04 22:31 UTC (permalink / raw)
To: Aditya Merchant; +Cc: passt-dev, David Gibson, Paul Holzinger, Laurent Vivier
On Fri, 4 Dec 2026 13:01:16 +0530
Aditya Merchant <adityamerchant08@gmail.com> wrote:
> These are the follow-ups Stefano suggested after applying "conf: Follow
> changes to the host nameserver used for DNS forwarding":
>
> - 1/3 rewords the passt.1 sentence that was hard to read
> - 2/3 forgets a nameserver once resolv.conf doesn't list one for that IP
> version anymore, as we do at start-up
> - 3/3 follows changes in passt mode too, which needs openat() in passt's
> seccomp profile (34 to 35 syscalls on x86_64, pasta stays at 43)
>
> Tested on Kali (arm64, Linux 7.1) with the AppArmor profiles enforcing,
> using a small script that acts as a guest on passt's socket and sends
> DNS queries to the --dns-forward address. In passt mode, new queries
> reach the new nameserver after resolv.conf is replaced by rename,
> rewritten in place, filled in after starting without a nameserver, or
> replaced through a link into /run/resolvconf. With --dns-host, the
> address stays fixed. Once the nameserver is removed, queries aren't
> redirected anymore, and they are again once one is listed. Without the
> AppArmor rule that 3/3 moves to the passt abstraction, passt can't read
> resolv.conf under /run. pasta behaves as before, except that it now
> forgets a removed nameserver as well. The extended test passes, and its
> new cases fail on current master. 'make cppcheck' and 'make clang-tidy'
> pass.
>
> The SELinux modules build against Fedora 45's policy, but I couldn't try
> them with SELinux enforcing.
I just did, it all works as expected.
> Aditya Merchant (3):
> passt.1: Say plainly which nameserver new DNS flows go to
> conf: Forget host nameserver once it's removed from resolv.conf
> conf: Follow changes to the host nameserver in passt mode, too
Applied, thanks, great stuff as usual.
--
Stefano
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] conf: Forget host nameserver once it's removed from resolv.conf
2026-12-04 22:15 ` Jon Maloy
@ 2026-12-04 22:36 ` Stefano Brivio
0 siblings, 0 replies; 8+ messages in thread
From: Stefano Brivio @ 2026-12-04 22:36 UTC (permalink / raw)
To: Jon Maloy
Cc: Aditya Merchant, passt-dev, David Gibson, Paul Holzinger, Laurent Vivier
On Fri, 4 Dec 2026 17:15:24 -0500
Jon Maloy <jmaloy@redhat.com> wrote:
> 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.
All expected, so far.
> If we have an explicit --dns-forward address, they're sent to that
> address as such, and will usually time out.
Desired, if the address is removed.
> This is consistent with starting without a nameserver, but it is actually
> a visible change for a running instance.
I think it's consistent with the description from the man page, as
amended in the previous series from Aditya. That was the one
introducing the biggest visible change anyway.
> Maybe this should be mentioned in the commit message?
Too late at this point but I think it's actually obvious enough, and
also implicit in the "stop redirecting DNS queries" part.
--
Stefano
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-12-04 22:36 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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
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).