<feed xmlns='http://www.w3.org/2005/Atom'>
<title>passt/passt.c, 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>treewide: no L2 buffer in splice-only mode</title>
<updated>2026-12-04T21:54:18+00:00</updated>
<author>
<name>Stuart McLaren</name>
<email>stuart.mclaren@hpe.com</email>
</author>
<published>2026-12-03T17:56:24+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=66e115b7f2188dd8d49d5738959fecc540ce9727'/>
<id>66e115b7f2188dd8d49d5738959fecc540ce9727</id>
<content type='text'>
Save memory by not initializing L2 memory buffers when
running in --splice-only mode.

This reduces pasta memory use when running splice only.
For example, on one measured system, VmRSS went from
~12 MB to ~3 MB.

Signed-off-by: Stuart McLaren &lt;stuart.mclaren@hpe.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>
Save memory by not initializing L2 memory buffers when
running in --splice-only mode.

This reduces pasta memory use when running splice only.
For example, on one measured system, VmRSS went from
~12 MB to ~3 MB.

Signed-off-by: Stuart McLaren &lt;stuart.mclaren@hpe.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<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>udp, icmp: Remove unused timer_run fields from protocol contexts</title>
<updated>2026-07-20T21:27:10+00:00</updated>
<author>
<name>Laurent Vivier</name>
<email>lvivier@redhat.com</email>
</author>
<published>2026-06-19T10:30:06+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=81a99ce3e73bde052f792d52d260eef5b2a821a8'/>
<id>81a99ce3e73bde052f792d52d260eef5b2a821a8</id>
<content type='text'>
Since 260075bde769 ("tcp, udp, fwd: Run all port scanning from a
single timer"), CALL_PROTO_HANDLER() is only used for TCP.  UDP and
ICMP timers now run from flow_defer_handler(), making the timer_run
fields in struct udp_ctx and struct icmp_ctx dead stores.

Remove the unused fields, drop struct icmp_ctx entirely (it has no
remaining members), and stop initialising them in timer_init().

Signed-off-by: Laurent Vivier &lt;lvivier@redhat.com&gt;
Reviewed-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>
Since 260075bde769 ("tcp, udp, fwd: Run all port scanning from a
single timer"), CALL_PROTO_HANDLER() is only used for TCP.  UDP and
ICMP timers now run from flow_defer_handler(), making the timer_run
fields in struct udp_ctx and struct icmp_ctx dead stores.

Remove the unused fields, drop struct icmp_ctx entirely (it has no
remaining members), and stop initialising them in timer_init().

Signed-off-by: Laurent Vivier &lt;lvivier@redhat.com&gt;
Reviewed-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>main: Ensure fds 0-2 are populated</title>
<updated>2026-07-18T07:54:37+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2026-07-17T05:46:34+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=c80d9db312dfa98909bf3b3a5b2655785cdb3b07'/>
<id>c80d9db312dfa98909bf3b3a5b2655785cdb3b07</id>
<content type='text'>
Usually fds 0-2 are stdin, stdout and stderr.  However, there are certain
use cases where passt can be invoked with one or more of those standard fds
closed.  In those cases, anything we open might be placed in one of the
standard slots.  For the handful of things we open early enough, this can
be a problem because we close fds 0-2 in __daemon(), replacing them with
dupes of /dev/null.

We could avoid closing those fds in __daemon() if they're not standard
streams.  However, leaving things other than the standard streams in fds
0-2 is a footgun: a stray printf() that occurs in a circumstance it
shouldn't could send harmful garbage to a device or socket.  It's also
likely to be confusing if debugging with strace or similar.

To avoid this, fill any missing standard streams with a dupe of /dev/null,
right after isolate_fds().  Since open()ing /dev/null itself could land in
one of those fd 0-2 slots, we need to be careful when we close it not to
leave a new gap.

Link: https://bugs.passt.top/show_bug.cgi?id=215
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>
Usually fds 0-2 are stdin, stdout and stderr.  However, there are certain
use cases where passt can be invoked with one or more of those standard fds
closed.  In those cases, anything we open might be placed in one of the
standard slots.  For the handful of things we open early enough, this can
be a problem because we close fds 0-2 in __daemon(), replacing them with
dupes of /dev/null.

We could avoid closing those fds in __daemon() if they're not standard
streams.  However, leaving things other than the standard streams in fds
0-2 is a footgun: a stray printf() that occurs in a circumstance it
shouldn't could send harmful garbage to a device or socket.  It's also
likely to be confusing if debugging with strace or similar.

To avoid this, fill any missing standard streams with a dupe of /dev/null,
right after isolate_fds().  Since open()ing /dev/null itself could land in
one of those fd 0-2 slots, we need to be careful when we close it not to
leave a new gap.

Link: https://bugs.passt.top/show_bug.cgi?id=215
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>isolation, conf: Set c-&gt;fd_tap from early parse of --fd</title>
<updated>2026-07-18T07:54:27+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2026-07-17T05:46:31+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=33e0fbc396f494e2fdd8033191b76d2c4aef43ec'/>
<id>33e0fbc396f494e2fdd8033191b76d2c4aef43ec</id>
<content type='text'>
We parse --fd twice: once in isolate_initial() just to avoid clobbering
the passed in fd.  Then we parse it "for real" in conf(), to set c-&gt;fd_tap
and other configuration variables.

Change this, so that we return the value parsed early from
isolate_initial() and set c-&gt;fd_tap from that.  This doesn't accomplish
much immediately, but will make some further cleanups possible.

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 parse --fd twice: once in isolate_initial() just to avoid clobbering
the passed in fd.  Then we parse it "for real" in conf(), to set c-&gt;fd_tap
and other configuration variables.

Change this, so that we return the value parsed early from
isolate_initial() and set c-&gt;fd_tap from that.  This doesn't accomplish
much immediately, but will make some further cleanups possible.

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>isolation: Move close_open_files() to isolate_fds()</title>
<updated>2026-07-18T07:54:24+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2026-07-17T05:46:30+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=0a510066e9169409e9021798224bea5297c1e529'/>
<id>0a510066e9169409e9021798224bea5297c1e529</id>
<content type='text'>
Most functions in util.c are, well, utilities, that are useful in a bunch
of places.  close_open_files(), however, is very specific, it's only called
from isolate_initial(), and performs a very specific step of our self
isolation.  So, it makes more sense as a function in isolate.c - move it
there and rename it to isolate_fds().

In addition, call it directly from main() rather than from
isolate_initial().  That's pretty arbitrary now, but will make some
subsequent changes easier.

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>
Most functions in util.c are, well, utilities, that are useful in a bunch
of places.  close_open_files(), however, is very specific, it's only called
from isolate_initial(), and performs a very specific step of our self
isolation.  So, it makes more sense as a function in isolate.c - move it
there and rename it to isolate_fds().

In addition, call it directly from main() rather than from
isolate_initial().  That's pretty arbitrary now, but will make some
subsequent changes easier.

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: Always close pidfile_fd, not just when daemonizing</title>
<updated>2026-07-18T07:53:47+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2026-07-17T05:46:29+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=b0ca29ed09e9f6e33408b7207eaf4dec9a650e89'/>
<id>b0ca29ed09e9f6e33408b7207eaf4dec9a650e89</id>
<content type='text'>
In order to satisfy static checkers that we don't have an fd leak,
a9c61ffaf153 added a close() of c-&gt;pidfile_fd, amongst others.  However,
it only close()s it in the case where we daemonize into the background.
While less universally useful in the foreground / non-daemon case, it's
perfectly reasonable to still have a pidfile.  We'll still write it, and
we should still close it.

Fixes: a9c61ffaf153 ("util, passt: Close daemon-lifetime fds on exit to avoid Coverity warning")
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>
In order to satisfy static checkers that we don't have an fd leak,
a9c61ffaf153 added a close() of c-&gt;pidfile_fd, amongst others.  However,
it only close()s it in the case where we daemonize into the background.
While less universally useful in the foreground / non-daemon case, it's
perfectly reasonable to still have a pidfile.  We'll still write it, and
we should still close it.

Fixes: a9c61ffaf153 ("util, passt: Close daemon-lifetime fds on exit to avoid Coverity warning")
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: Initialise listening socket fds to -1</title>
<updated>2026-07-15T21:18:38+00:00</updated>
<author>
<name>Jon Maloy</name>
<email>jmaloy@redhat.com</email>
</author>
<published>2026-07-09T21:56:51+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=80cb5cf5a9b1b16a30c8ae4c47a87c8bfc91f20c'/>
<id>80cb5cf5a9b1b16a30c8ae4c47a87c8bfc91f20c</id>
<content type='text'>
fd_tap_listen, fd_control_listen, and fd_repair_listen are file
descriptors and should be initialised to -1 rather than the implicit
0, consistent with the other fd fields in passt_ctx.

Signed-off-by: Jon Maloy &lt;jmaloy@redhat.com&gt;
Reviewed-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>
fd_tap_listen, fd_control_listen, and fd_repair_listen are file
descriptors and should be initialised to -1 rather than the implicit
0, consistent with the other fd fields in passt_ctx.

Signed-off-by: Jon Maloy &lt;jmaloy@redhat.com&gt;
Reviewed-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>flow, treewide: Promote priority of selected flow-linked messages</title>
<updated>2026-06-22T07:13:46+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2026-06-19T15:26:25+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=74863b01d304beda59d7a7bc9cfa887683fedd95'/>
<id>74863b01d304beda59d7a7bc9cfa887683fedd95</id>
<content type='text'>
Most of out flow specific log messages are debug level for fear of flooding
the logs, even when they report real error conditions that might be off
significance.

Now that we have the mechanisms for log message rate limiting, we can do
better.  Promote many flow related messages to warning or error level, with
rate limiting.  While we're there add ratelimiting to a handful of existing
warning or error level messages.

They general heuristic is to promote messages that report a failure which
is not something that should be triggered by the guest doing something
weird.  This mostly means failures from socket operations we expect to be
legitimate.

Adding the ratelimiting means plumbing the 'now' timestamp through much
more of the code, hence the large churn.

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>
Most of out flow specific log messages are debug level for fear of flooding
the logs, even when they report real error conditions that might be off
significance.

Now that we have the mechanisms for log message rate limiting, we can do
better.  Promote many flow related messages to warning or error level, with
rate limiting.  While we're there add ratelimiting to a handful of existing
warning or error level messages.

They general heuristic is to promote messages that report a failure which
is not something that should be triggered by the guest doing something
weird.  This mostly means failures from socket operations we expect to be
legitimate.

Adding the ratelimiting means plumbing the 'now' timestamp through much
more of the code, hence the large churn.

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>
</feed>
