public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Aditya Merchant <adityamerchant08@gmail.com>
To: passt-dev@passt.top
Cc: Stefano Brivio <sbrivio@redhat.com>,
	David Gibson <david@gibson.dropbear.id.au>,
	Paul Holzinger <pholzing@redhat.com>
Subject: [PATCH v2 0/2] Follow changes to the host nameserver for DNS forwarding
Date: Fri, 13 Nov 2026 16:51:12 +0530	[thread overview]
Message-ID: <20261113112114.38764-1-adityamerchant08@gmail.com> (raw)

Patch 1/2 is v2 of "conf: Follow changes to the host nameserver used for
DNS forwarding", reworked after Stefano's review. Patch 2/2 terminates
the inotify buffer in pasta_netns_quit_inotify_handler() as well, as
also pointed out there.

v2:
- Only follow a file called resolv.conf, or a link to one, and never
  open anything else through the copy of its directory: the name is now
  fixed, not kept in struct ctx (Stefano)
- Don't follow changes if we can't make the copy read-only, which needs
  Linux 5.12, instead of going on with a writable copy (Stefano)
- Never copy the root directory, if resolv.conf turns out to be there
- Terminate the inotify buffer, and stop at the first relevant event or
  at an overflow (Stefano)
- SELinux: allow watching /etc, and the directories NetworkManager and
  systemd-resolved use under /run (Stefano)
- AppArmor: a single rule for the locations under /run, as we don't
  follow stub-resolv.conf anymore
- Add test/pasta_options/dns_host_follow (Stefano)
- Rebase on current master

Tested on Kali (arm64, Linux 7.1), with the AppArmor profile enforcing.
With pasta alone, these changes are followed: resolv.conf replaced by
rename, rewritten in place, empty at start and filled in later, and as a
link into /run/resolvconf or /run/systemd/resolve. With --dns-host, or
with a link to stub-resolv.conf, the address stays fixed, as expected.
With rootless Podman 5.8.6 and a bridge network, container DNS keeps
working after the host switches nameserver (it fails with the current
Debian package). The new test passes, and fails without patch 1/2. If
mount_setattr() fails (I faked that), pasta doesn't follow changes and
says so in a debug message. pasta still exits when the namespace file
it watches is removed. 'make cppcheck' and 'make clang-tidy' pass.

The SELinux module builds against Fedora 45's policy, but I couldn't try
it with SELinux enforcing.

Aditya Merchant (2):
  conf: Follow changes to the host nameserver used for DNS forwarding
  pasta: Terminate inotify buffer, skip nameless events in netns watch

 conf.c                              | 259 ++++++++++++++++++++++++++--
 conf.h                              |   2 +
 contrib/apparmor/abstractions/pasta |   4 +
 contrib/selinux/pasta.te            |   4 +
 epoll_type.h                        |   2 +
 isolation.c                         |   6 +-
 isolation.h                         |   2 +-
 linux_dep.h                         |  30 ++++
 passt.1                             |   5 +-
 passt.c                             |   5 +
 passt.h                             |   7 +
 pasta.c                             |   5 +-
 test/pasta_options/dns_host_follow  |  28 +++
 test/run                            |   1 +
 14 files changed, 346 insertions(+), 14 deletions(-)
 create mode 100644 test/pasta_options/dns_host_follow

-- 
2.50.1 (Apple Git-155)


             reply	other threads:[~2026-11-13 11:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 11:21 Aditya Merchant [this message]
2026-11-13 11:21 ` [PATCH v2 1/2] conf: Follow changes to the host nameserver used " Aditya Merchant
2026-11-13 11:21 ` [PATCH v2 2/2] pasta: Terminate inotify buffer, skip nameless events in netns watch Aditya Merchant

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=20261113112114.38764-1-adityamerchant08@gmail.com \
    --to=adityamerchant08@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --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).