<feed xmlns='http://www.w3.org/2005/Atom'>
<title>passt/conf.h, branch 2026_12_04.a39d958</title>
<subtitle>Plug A Simple Socket Transport</subtitle>
<link rel='alternate' type='text/html' href='https://passt.top/passt/'/>
<entry>
<title>conf: Follow changes to the host nameserver used for DNS forwarding</title>
<updated>2026-11-29T23:37:09+00:00</updated>
<author>
<name>Aditya Merchant</name>
<email>adityamerchant08@gmail.com</email>
</author>
<published>2026-11-13T11:21:13+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=f6d66985479641283059841b71966f84b5188890'/>
<id>f6d66985479641283059841b71966f84b5188890</id>
<content type='text'>
We read the host's /etc/resolv.conf once, at start, and forward queries
sent to the --dns-forward address to the first nameserver listed there.
If the host then joins another network, connects to a VPN, or pasta
starts before the network is configured, that nameserver goes stale and
name resolution in the namespace stops working until pasta restarts.
With rootless Podman, that means stopping every container using the
rootless network namespace.

In pasta mode, if we forward DNS queries for an IP version, and the host
nameserver for it comes from resolv.conf (no --dns-host or --dns), watch
resolv.conf with inotify and read it again as it changes, so that new
DNS flows go to its current first nameserver. Watch the directory, not
the file, as NetworkManager and others replace resolv.conf by renaming
a new file over it. If resolv.conf is a symbolic link, watch the
directory of its target, as long as that's also called resolv.conf:
the other usual target, systemd-resolved's stub-resolv.conf, always
points to its local stub resolver anyway.

Once sandboxed, we can't open files by path, and keeping a descriptor
for the directory would undo the filesystem isolation: lookups of ".."
from it reach the rest of the host filesystem. Instead, right after
isolate_prefork() unshares our mount namespace, and before mounts become
unbindable, take a detached copy of the directory with open_tree() and
OPEN_TREE_CLONE: lookups from its root can't go above it, so the
directory holding resolv.conf is all we can still see. Make that copy
read-only, and only ever open resolv.conf from it. This needs Linux 5.12
or later: if any step fails, or if we can't read resolv.conf through the
copy, we don't follow changes.

AppArmor resolves paths of files on a detached mount relative to their
filesystem, so allow the usual locations of resolv.conf under /run with
paths relative to /run, too. For SELinux, allow watching /etc, and the
directories under /run used by NetworkManager and systemd-resolved.

Flows that already exist keep their target, so a client reusing the
same source port keeps reaching the old nameserver until its flow
expires.

The new test replaces resolv.conf on an overlay mounted on /etc, in a
separate mount namespace, and checks that we pick up the new nameserver.

Link: https://github.com/podman-container-tools/podman/issues/29130
Link: https://archives.passt.top/passt-dev/20230121104703.3ebcc753@elisabeth/
Signed-off-by: Aditya Merchant &lt;adityamerchant08@gmail.com&gt;
Reviewed-by: Laurent Vivier &lt;lvivier@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We read the host's /etc/resolv.conf once, at start, and forward queries
sent to the --dns-forward address to the first nameserver listed there.
If the host then joins another network, connects to a VPN, or pasta
starts before the network is configured, that nameserver goes stale and
name resolution in the namespace stops working until pasta restarts.
With rootless Podman, that means stopping every container using the
rootless network namespace.

In pasta mode, if we forward DNS queries for an IP version, and the host
nameserver for it comes from resolv.conf (no --dns-host or --dns), watch
resolv.conf with inotify and read it again as it changes, so that new
DNS flows go to its current first nameserver. Watch the directory, not
the file, as NetworkManager and others replace resolv.conf by renaming
a new file over it. If resolv.conf is a symbolic link, watch the
directory of its target, as long as that's also called resolv.conf:
the other usual target, systemd-resolved's stub-resolv.conf, always
points to its local stub resolver anyway.

Once sandboxed, we can't open files by path, and keeping a descriptor
for the directory would undo the filesystem isolation: lookups of ".."
from it reach the rest of the host filesystem. Instead, right after
isolate_prefork() unshares our mount namespace, and before mounts become
unbindable, take a detached copy of the directory with open_tree() and
OPEN_TREE_CLONE: lookups from its root can't go above it, so the
directory holding resolv.conf is all we can still see. Make that copy
read-only, and only ever open resolv.conf from it. This needs Linux 5.12
or later: if any step fails, or if we can't read resolv.conf through the
copy, we don't follow changes.

AppArmor resolves paths of files on a detached mount relative to their
filesystem, so allow the usual locations of resolv.conf under /run with
paths relative to /run, too. For SELinux, allow watching /etc, and the
directories under /run used by NetworkManager and systemd-resolved.

Flows that already exist keep their target, so a client reusing the
same source port keeps reaching the old nameserver until its flow
expires.

The new test replaces resolv.conf on an overlay mounted on /etc, in a
separate mount namespace, and checks that we pick up the new nameserver.

Link: https://github.com/podman-container-tools/podman/issues/29130
Link: https://archives.passt.top/passt-dev/20230121104703.3ebcc753@elisabeth/
Signed-off-by: Aditya Merchant &lt;adityamerchant08@gmail.com&gt;
Reviewed-by: Laurent Vivier &lt;lvivier@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>pasta: Add --pass-fds option to skip closing file descriptors</title>
<updated>2026-11-10T23:09:24+00:00</updated>
<author>
<name>Richard Lawrence</name>
<email>rlawrence@tamu.edu</email>
</author>
<published>2026-11-04T20:20:19+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=d22d51229f2a8a9b594ad3fc642f2845b4ef44e8'/>
<id>d22d51229f2a8a9b594ad3fc642f2845b4ef44e8</id>
<content type='text'>
When pasta spawns a command (`pasta [options] -- [command]`), all open file
descriptors inherited from the parent process except standard streams (0-2)
and the tap descriptor (`--fd`) are normally closed by `isolate_fds()`.

However, when pasta is used for testing, development, or launching tools like
Bubblewrap (`bwrap`), the spawned command may require file descriptors
passed directly from the parent process. In this case, closing inherited file
descriptors breaks expected behavior.

Add a boolean `--pass-fds` flag for pasta mode that skips the `close_range()`
cleanup step in `isolate_fds()`, leaving all open file descriptors intact
for the child command.

Summary of changes:

- Update `conf_tap_fd()` to `conf_fds()`, allowing early parsing of both
  `-F`/`--fd` and `--pass-fds` before main option processing.
- Update `isolate_fds()` to check `c-&gt;pass_fds`: if set, skip calling
  `close_range()` while still relocating the tap fd out of standard stream
  range (0-2) if needed.
- Enforce validation in `conf()` ensuring `--pass-fds` is restricted to pasta
  mode when spawning a command (incompatible with attaching to an
  existing netns).
- Update man page and usage help output.

Link: https://bugs.passt.top/show_bug.cgi?id=204
Signed-off-by: Richard Lawrence &lt;rlawrence@tamu.edu&gt;
[sbrivio: Fix trivial merge conflict and minor coding style issues]
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When pasta spawns a command (`pasta [options] -- [command]`), all open file
descriptors inherited from the parent process except standard streams (0-2)
and the tap descriptor (`--fd`) are normally closed by `isolate_fds()`.

However, when pasta is used for testing, development, or launching tools like
Bubblewrap (`bwrap`), the spawned command may require file descriptors
passed directly from the parent process. In this case, closing inherited file
descriptors breaks expected behavior.

Add a boolean `--pass-fds` flag for pasta mode that skips the `close_range()`
cleanup step in `isolate_fds()`, leaving all open file descriptors intact
for the child command.

Summary of changes:

- Update `conf_tap_fd()` to `conf_fds()`, allowing early parsing of both
  `-F`/`--fd` and `--pass-fds` before main option processing.
- Update `isolate_fds()` to check `c-&gt;pass_fds`: if set, skip calling
  `close_range()` while still relocating the tap fd out of standard stream
  range (0-2) if needed.
- Enforce validation in `conf()` ensuring `--pass-fds` is restricted to pasta
  mode when spawning a command (incompatible with attaching to an
  existing netns).
- Update man page and usage help output.

Link: https://bugs.passt.top/show_bug.cgi?id=204
Signed-off-by: Richard Lawrence &lt;rlawrence@tamu.edu&gt;
[sbrivio: Fix trivial merge conflict and minor coding style issues]
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>conf: Make conf_tap_fd() operate more like conf_mode()</title>
<updated>2026-07-18T07:54:29+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2026-07-17T05:46:32+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=ab825955836cb04c1e994d17af4c50a243ea67a0'/>
<id>ab825955836cb04c1e994d17af4c50a243ea67a0</id>
<content type='text'>
We have two cases where we need to parse specific options early:
conf_tap_fd() and conf_mode().  conf_tap_fd() has a slightly odd interface,
requiring the caller to use getopt_long() to find the right option, then
pass it in.  Alter it to work like conf_mode() instead, where all the
command line parsing logic is contained within the conf.c function.

This is slightly more lines, but has a clearer division of responsibility.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We have two cases where we need to parse specific options early:
conf_tap_fd() and conf_mode().  conf_tap_fd() has a slightly odd interface,
requiring the caller to use getopt_long() to find the right option, then
pass it in.  Alter it to work like conf_mode() instead, where all the
command line parsing logic is contained within the conf.c function.

This is slightly more lines, but has a clearer division of responsibility.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>conf: Remove duplicate parsing of -F option</title>
<updated>2026-07-04T11:13:59+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2026-07-03T03:54:36+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=2cdb27a32f3d494109d7eb3737fb7362340515c1'/>
<id>2cdb27a32f3d494109d7eb3737fb7362340515c1</id>
<content type='text'>
The -F option is parsed in conf() along with everything else.  However,
because it informs what fds we can close at startup, we also have a special
case parse of it in close_open_files().

At present we duplicate the parsing and validation code, which is a bit
risky.  Avoid that with a conf_tap_fd() helper.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The -F option is parsed in conf() along with everything else.  However,
because it informs what fds we can close at startup, we also have a special
case parse of it in close_open_files().

At present we duplicate the parsing and validation code, which is a bit
risky.  Avoid that with a conf_tap_fd() helper.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>pesto, conf: Have pesto connect to passt and check versions</title>
<updated>2026-05-07T06:06:30+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2026-05-03T21:55:53+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=f1d893ca1926e58ae5a2bf5602b515a883f3f994'/>
<id>f1d893ca1926e58ae5a2bf5602b515a883f3f994</id>
<content type='text'>
Start implementing pesto in earnest.  Create a control/configuration
socket in passt.  Have pesto connect to it and retrieve a server greeting
Perform some basic version checking.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
[sbrivio: Avoid potential recursive calling between conf_accept() and
 conf_close(), reported by clang-tidy]
[sbrivio: In conf(), check we're not exceeding sizeof(c-&gt;control_path)
 instead of sizeof(c-&gt;socket_path), and, in pesto's main(), print
 argv[optind] instead of argv[1] to indicate an invalid socket path,
 both reported by Jon Maloy]
[sbrivio: In pesto's main(), drop unnecessary newline from error
 message, reported by Laurent]
[sbrivio: Don't use SOCK_NONBLOCK on accept4(), as that only applies
 to the *new* file descriptor, which we don't want -- set O_NONBLOCK
 on the listening file descriptor using fcntl()]
[sbrivio: Switch to protocol version 1, and reflect the true magic
 behind pesto, i.e. basil, into the magic string]
[sbrivio: Fix conflicts in the Makefile caused by the fact that I'm
 not merging a previous series reworking it]
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
Reviewed-by: Laurent Vivier &lt;lvivier@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Start implementing pesto in earnest.  Create a control/configuration
socket in passt.  Have pesto connect to it and retrieve a server greeting
Perform some basic version checking.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
[sbrivio: Avoid potential recursive calling between conf_accept() and
 conf_close(), reported by clang-tidy]
[sbrivio: In conf(), check we're not exceeding sizeof(c-&gt;control_path)
 instead of sizeof(c-&gt;socket_path), and, in pesto's main(), print
 argv[optind] instead of argv[1] to indicate an invalid socket path,
 both reported by Jon Maloy]
[sbrivio: In pesto's main(), drop unnecessary newline from error
 message, reported by Laurent]
[sbrivio: Don't use SOCK_NONBLOCK on accept4(), as that only applies
 to the *new* file descriptor, which we don't want -- set O_NONBLOCK
 on the listening file descriptor using fcntl()]
[sbrivio: Switch to protocol version 1, and reflect the true magic
 behind pesto, i.e. basil, into the magic string]
[sbrivio: Fix conflicts in the Makefile caused by the fact that I'm
 not merging a previous series reworking it]
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
Reviewed-by: Laurent Vivier &lt;lvivier@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>conf: Move mode detection into helper function</title>
<updated>2025-03-12T22:08:33+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2025-03-12T02:18:32+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=4b17d042c7e4f6e5b5a770181e2ebd53ec8e73d4'/>
<id>4b17d042c7e4f6e5b5a770181e2ebd53ec8e73d4</id>
<content type='text'>
One of the first things we need to do is determine if we're in passt mode
or pasta mode.  Currently this is open-coded in main(), by examining
argv[0].  We want to complexify this a bit in future to cover vhost-user
mode as well.  Prepare for this, by moving the mode detection into a new
conf_mode() function.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
One of the first things we need to do is determine if we're in passt mode
or pasta mode.  Currently this is open-coded in main(), by examining
argv[0].  We want to complexify this a bit in future to cover vhost-user
mode as well.  Prepare for this, by moving the mode detection into a new
conf_mode() function.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>port_fwd: Move automatic port forwarding code to port_fwd.[ch]</title>
<updated>2023-11-07T08:53:14+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2023-11-03T02:22:56+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=e90f2770ae44de238a227f884e806637a2b80403'/>
<id>e90f2770ae44de238a227f884e806637a2b80403</id>
<content type='text'>
The implementation of scanning /proc files to do automatic port forwarding
is a bit awkwardly split between procfs_scan_listen() in util.c,
get_bound_ports() and related functions in conf.c and the initial setup
code in conf().

Consolidate all of this into port_fwd.h, which already has some related
definitions, and a new port_fwd.c.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The implementation of scanning /proc files to do automatic port forwarding
is a bit awkwardly split between procfs_scan_listen() in util.c,
get_bound_ports() and related functions in conf.c and the initial setup
code in conf().

Consolidate all of this into port_fwd.h, which already has some related
definitions, and a new port_fwd.c.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>passt: Relicense to GPL 2.0, or any later version</title>
<updated>2023-04-06T16:00:33+00:00</updated>
<author>
<name>Stefano Brivio</name>
<email>sbrivio@redhat.com</email>
</author>
<published>2023-04-05T18:11:44+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=ca2749e1bd520c6a1dbca24f1561ee31dd833a54'/>
<id>ca2749e1bd520c6a1dbca24f1561ee31dd833a54</id>
<content type='text'>
In practical terms, passt doesn't benefit from the additional
protection offered by the AGPL over the GPL, because it's not
suitable to be executed over a computer network.

Further, restricting the distribution under the version 3 of the GPL
wouldn't provide any practical advantage either, as long as the passt
codebase is concerned, and might cause unnecessary compatibility
dilemmas.

Change licensing terms to the GNU General Public License Version 2,
or any later version, with written permission from all current and
past contributors, namely: myself, David Gibson, Laine Stump, Andrea
Bolognani, Paul Holzinger, Richard W.M. Jones, Chris Kuhn, Florian
Weimer, Giuseppe Scrivano, Stefan Hajnoczi, and Vasiliy Ulyanov.

Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In practical terms, passt doesn't benefit from the additional
protection offered by the AGPL over the GPL, because it's not
suitable to be executed over a computer network.

Further, restricting the distribution under the version 3 of the GPL
wouldn't provide any practical advantage either, as long as the passt
codebase is concerned, and might cause unnecessary compatibility
dilemmas.

Change licensing terms to the GNU General Public License Version 2,
or any later version, with written permission from all current and
past contributors, namely: myself, David Gibson, Laine Stump, Andrea
Bolognani, Paul Holzinger, Richard W.M. Jones, Chris Kuhn, Florian
Weimer, Giuseppe Scrivano, Stefan Hajnoczi, and Vasiliy Ulyanov.

Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>treewide: Add include guards</title>
<updated>2022-03-29T13:35:38+00:00</updated>
<author>
<name>Stefano Brivio</name>
<email>sbrivio@redhat.com</email>
</author>
<published>2022-03-25T23:05:31+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=965f603238a92b6ab8cd8a0592e0fb65c096b3e1'/>
<id>965f603238a92b6ab8cd8a0592e0fb65c096b3e1</id>
<content type='text'>
...at the moment, just for consistency with packet.h, icmp.h,
tcp.h and udp.h.

Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
...at the moment, just for consistency with packet.h, icmp.h,
tcp.h and udp.h.

Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>LICENSES: Add license text files, add missing notices, fix SPDX tags</title>
<updated>2021-10-20T06:29:30+00:00</updated>
<author>
<name>Stefano Brivio</name>
<email>sbrivio@redhat.com</email>
</author>
<published>2021-10-19T10:43:28+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=087b5f4dbb9e3f767a8afbb6c1001c509965940b'/>
<id>087b5f4dbb9e3f767a8afbb6c1001c509965940b</id>
<content type='text'>
SPDX tags don't replace license files. Some notices were missing and
some tags were not according to the SPDX specification, too.

Now reuse --lint from the REUSE tool (https://reuse.software/) passes.

Reported-by: Martin Hauke &lt;mardnh@gmx.de&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
SPDX tags don't replace license files. Some notices were missing and
some tags were not according to the SPDX specification, too.

Now reuse --lint from the REUSE tool (https://reuse.software/) passes.

Reported-by: Martin Hauke &lt;mardnh@gmx.de&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
