Commit Graph

2150 Commits

Author SHA1 Message Date
Thomas Eizinger
e7cf00eb53 chore(relay): log when encountering unsupported channel mappings (#8617)
Currently, the relays eBPF module only supports routing from IPv4 to
IPv4 as well as IPv6 to IPv6. In general, TURN servers can also route
from IPv4 to IPv6 and vice versa. Our userspace routing supports that
but doing the same in the eBPF code is a bit more involved. We'd need to
move around the headers a bit more (IPv4 and IPv6 headers are different
in size), as well as configure the respective "source" address for each
interface. Currently, we simply take the destination address of the
incoming packet as the new source address. When routing across IP
versions, that doesn't work.

To gain some more insight into how often this happens, we add these
additional maps and populate them. This allows us to emit a dedicated
log message whenever we encounter a packet for such a mapping.

First, we always do check for an entry in the maps that we can handle.
If we can't we check the other map and special-case the error.
Otherwise, we fall back to the previous "no entry" error. We shouldn't
really see these "no entry" errors anymore now, unless someone starts
probing our relays for active channels.
2025-04-02 12:07:59 +00:00
Thomas Eizinger
bac5cfa4cb fix(connlib): set idle timer to be longer than ICE timeout (#8612)
Our idle connection detection works based on incoming and outgoing
packets, whichever one happened later. If we have not received or sent
packets for longer than `MAX_IDLE`, we transition into idle mode where
we configure our ICE agent to only send binding requests every 60
seconds.

Our ICE timeout in non-idle mode is just north of 10 seconds (the
formula is a bit tricky so don't have the accurate number). This can
cause a problem whenever a Gateway disappears. We leave the idle mode as
soon as we send a packet through the Gateway. Thus, what we intended to
happen is that, as long as you keep trying to connect to the Gateway, we
will leave the idle mode, increase our rate of STUN bindings through the
ICE agent and detect within ~10s that the Gateway is gone.

What actually happens is that, IF whatever resource you are trying to
talk to is a DNS resource (which is very likely) and the application
starts off with a DNS query, then we will reset the local DNS resource
NAT state and ping the Gateway to set up the NAT again (we do this to
ensure we don't have stale DNS entries on the Gateway). This message is
only sent once and all other packets are buffered. Thus, the connection
will go back to idle before the newly sent STUN binding requests can
determine that the connection is actually broken.

Resolves: #8551
2025-04-02 07:03:35 +00:00
Thomas Eizinger
4695f289a0 chore(relay): add more logs to eBPF stats reporting (#8613) 2025-04-02 06:50:01 +00:00
Thomas Eizinger
59453bd063 chore(eBPF): improve log messages (#8611) 2025-04-02 04:52:45 +00:00
Thomas Eizinger
fb1311991a fix(eBPF): correctly set Ethernet addresses (#8601)
At present, the eBPF code assumes that the incoming packet needs to be
sent back to the same MAC address that it came from. This is only true
if there is at least one IP layer hop in-between the relay and the
Client / Gateway. When setting up Firezone in my local LAN to debug the
eBPF code, all components are within the same subnet and thus can send
packets directly to each other, without having to go through the router.
In such a scenario, simply swapping the Ethernet addresses is not
correct.

As part of witnessing traffic coming in via the network, we can build up
a mapping of IP to MAC address. This mapping can then later be used to
set the correct MAC address for a given destination IP. All of this
functions entirely without interaction from userspace.

Unless you are running in a LAN environment, most if not all IPs will
point to the same MAC address (the one of the next IP layer hop, i.e.
the router). For the very first packet that we want to relay, we will
not have a MAC address for the destination IP. This doesn't matter
though, we simply pass that packet up to userspace and handle it there.
Pretty much all communication on the Internet is bi-directional because
you need some kind of ACK. As soon as we receive the first ACK, e.g. the
response to a binding request, we will learn the MAC address for the
given target IP and the eBPF router can kick in for all packets going
forward.

Related: #7518
2025-04-02 03:20:37 +00:00
Thomas Eizinger
f71995f7a5 fix(eBPF): incorporate change in UDP payload into checksum (#8603)
The UDP checksum also includes the entire payload. Removing and adding
bytes to the payload therefore needs to be reflected in the checksum
update that we perform. When we add the channel data header, we need to
add the bytes to the checksum and when we remove them, they need to be
removed.

Related: #7518
2025-04-01 16:23:44 +00:00
Thomas Eizinger
e58ec73bbc refactor(eBPF): imply XDP_TX from Ok(()) (#8604)
Currently, the eBPF code isn't consistent in how it handles XDP actions.
For some cases, we return errors and then map them to `XDP_PASS` or
`XDP_DROP`. For others, we return `Ok(XDP_PASS)`. This is unnecessarily
hard to understand.

We refactor the eBPF kernel to ALWAYS use `Error`s for all code-paths
that don't end in `XDP_TX`, i.e. when we successfully modified the
packet and want to send it back out.

In addition, we also change the way we log these errors. Not all errors
are equal and most `XDP_PASS` actions don't need to be logged. Those
packets are simply passing through.

Finally, we also introduce new checks in case any calls to the eBPF
helper functions fail.

Related: #7518
2025-04-01 13:42:00 +00:00
Thomas Eizinger
cff14b3da0 feat(relay): make interface for eBPF program configurable (#8592) 2025-04-01 08:20:27 +00:00
Thomas Eizinger
a942dee723 chore(eBPF): don't count channel data header as relayed bytes (#8590) 2025-04-01 04:31:06 +00:00
Thomas Eizinger
bb36156ea8 chore(eBPF): remove commented out codeblock (#8588)
This is a leftover from debugging trying to make the verifier happy.
2025-04-01 00:10:36 +00:00
Thomas Eizinger
db76cc3844 fix(relay): reduce memory usage of eBPF program to < 100MB (#8587)
At present, the eBPF program would try to pre-allocate around 800MB of
memory for all entries in the maps. This would allow for 1 million
channel mappings. We don't need that many to begin with. Reducing the
max number of channels down to 65536 reduces our memory usage to less
than 100MB.

Related: #7518

---------

Signed-off-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-04-01 00:08:07 +00:00
Thomas Eizinger
1d0ecf94b8 feat(relay): record metrics about bytes relayed via eBPF (#8556)
Perf events are designed to be an extremely efficient way of
transferring data from an eBPF kernel to the user-space program. In
order to monitor, how much traffic we are actually relaying via eBPF, we
introduce a dedicated `STATS` map that is a `PerfEventArray`.

The events from that array are read asynchronously in user-space and fed
into our OTEL metrics. They will show up in our Google Cloud metrics as
`data_relayed_ebpf_bytes`. We already have a metric for the total
relayed bytes. That counter is renamed to `data_relayed_userspace_bytes`
so we can clearly differentiate the two.
2025-03-31 21:57:31 +00:00
Thomas Eizinger
b51a68def0 feat(relay): implement eBPF routing for IPv6 (#8554)
This fills in the boilerplate for handling IPv6 packets in the eBPF
code. Unfortunately, we cannot add an integration test for this because
IPv6 doesn't have a checksum and thus doesn't allow the UDP checksum to
be set to 0. Because Linux (and other OSs too I'd assume) offload UDP
checksumming to the NIC yet on the loopback interface, the packets never
get to the NIC, our eBPF code sees only a partial checksum and can thus
updates the checksum incorrectly.

Related: #7518
Related: #8502

---------

Signed-off-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-03-31 21:22:11 +00:00
dependabot[bot]
9999027bc1 build(deps): bump resolv-conf from 0.7.0 to 0.7.1 in /rust (#8559)
Bumps [resolv-conf](https://github.com/hickory-dns/resolv-conf) from
0.7.0 to 0.7.1.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/hickory-dns/resolv-conf/commits">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=resolv-conf&package-manager=cargo&previous-version=0.7.0&new-version=0.7.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-31 21:03:14 +00:00
dependabot[bot]
435f6c05cb build(deps): bump clap from 4.5.28 to 4.5.34 in /rust (#8557)
Bumps [clap](https://github.com/clap-rs/clap) from 4.5.28 to 4.5.34.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/clap-rs/clap/releases">clap's
releases</a>.</em></p>
<blockquote>
<h2>v4.5.34</h2>
<h2>[4.5.34] - 2025-03-27</h2>
<h3>Fixes</h3>
<ul>
<li><em>(help)</em> Don't add extra blank lines with
<code>flatten_help(true)</code> and subcommands without arguments</li>
</ul>
<h2>v4.5.33</h2>
<h2>[4.5.33] - 2025-03-26</h2>
<h3>Fixes</h3>
<ul>
<li><em>(error)</em> When showing the usage of a suggestion for an
unknown argument, don't show the group</li>
</ul>
<h2>v4.5.32</h2>
<h2>[4.5.32] - 2025-03-10</h2>
<h3>Features</h3>
<ul>
<li>Add <code>Error::remove</code></li>
</ul>
<h3>Documentation</h3>
<ul>
<li><em>(cookbook)</em> Switch from <code>humantime</code> to
<code>jiff</code></li>
<li><em>(tutorial)</em> Better cover required vs optional</li>
</ul>
<h3>Internal</h3>
<ul>
<li>Update <code>pulldown-cmark</code></li>
</ul>
<h2>v4.5.31</h2>
<h2>[4.5.31] - 2025-02-24</h2>
<h3>Features</h3>
<ul>
<li>Add <code>ValueParserFactory</code> for
<code>Saturating&lt;T&gt;</code></li>
</ul>
<h2>v4.5.30</h2>
<h2>[4.5.30] - 2025-02-17</h2>
<h3>Fixes</h3>
<ul>
<li><em>(assert)</em> Allow <code>num_args(0..=1)</code> to be used with
<code>SetTrue</code></li>
<li><em>(assert)</em> Clean up rendering of <code>takes_values</code>
assertions</li>
</ul>
<h2>v4.5.29</h2>
<h2>[4.5.29] - 2025-02-11</h2>
<h3>Fixes</h3>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/clap-rs/clap/blob/master/CHANGELOG.md">clap's
changelog</a>.</em></p>
<blockquote>
<h2>[4.5.34] - 2025-03-27</h2>
<h3>Fixes</h3>
<ul>
<li><em>(help)</em> Don't add extra blank lines with
<code>flatten_help(true)</code> and subcommands without arguments</li>
</ul>
<h2>[4.5.33] - 2025-03-26</h2>
<h3>Fixes</h3>
<ul>
<li><em>(error)</em> When showing the usage of a suggestion for an
unknown argument, don't show the group</li>
</ul>
<h2>[4.5.32] - 2025-03-10</h2>
<h3>Features</h3>
<ul>
<li>Add <code>Error::remove</code></li>
</ul>
<h3>Documentation</h3>
<ul>
<li><em>(cookbook)</em> Switch from <code>humantime</code> to
<code>jiff</code></li>
<li><em>(tutorial)</em> Better cover required vs optional</li>
</ul>
<h3>Internal</h3>
<ul>
<li>Update <code>pulldown-cmark</code></li>
</ul>
<h2>[4.5.31] - 2025-02-24</h2>
<h3>Features</h3>
<ul>
<li>Add <code>ValueParserFactory</code> for
<code>Saturating&lt;T&gt;</code></li>
</ul>
<h2>[4.5.30] - 2025-02-17</h2>
<h3>Fixes</h3>
<ul>
<li><em>(assert)</em> Allow <code>num_args(0..=1)</code> to be used with
<code>SetTrue</code></li>
<li><em>(assert)</em> Clean up rendering of <code>takes_values</code>
assertions</li>
</ul>
<h2>[4.5.29] - 2025-02-11</h2>
<h3>Fixes</h3>
<ul>
<li>Change <code>ArgMatches::args_present</code> so not-present flags
are considered not-present (matching the documentation)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="5d2cdac3e6"><code>5d2cdac</code></a>
chore: Release</li>
<li><a
href="f1c10ebe58"><code>f1c10eb</code></a>
docs: Update changelog</li>
<li><a
href="a4d1a7fe2b"><code>a4d1a7f</code></a>
chore(ci): Take a break from template updates</li>
<li><a
href="e95ed396c4"><code>e95ed39</code></a>
Merge pull request <a
href="https://redirect.github.com/clap-rs/clap/issues/5775">#5775</a>
from vivienm/master</li>
<li><a
href="18f8d4c3f5"><code>18f8d4c</code></a>
chore(deps): Update Rust Stable to v1.82 (<a
href="https://redirect.github.com/clap-rs/clap/issues/5788">#5788</a>)</li>
<li><a
href="f35d8e09fb"><code>f35d8e0</code></a>
Merge pull request <a
href="https://redirect.github.com/clap-rs/clap/issues/5787">#5787</a>
from epage/template</li>
<li><a
href="1389d7d689"><code>1389d7d</code></a>
chore: Update from '_rust/main' template</li>
<li><a
href="dbc9faa79d"><code>dbc9faa</code></a>
chore(ci): Initialize git for template update</li>
<li><a
href="3dac2f3683"><code>3dac2f3</code></a>
chore(ci): Get history for template update</li>
<li><a
href="e1f77dacf1"><code>e1f77da</code></a>
chore(ci): Fix branch for template update</li>
<li>Additional commits viewable in <a
href="https://github.com/clap-rs/clap/compare/clap_complete-v4.5.28...clap_complete-v4.5.34">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=clap&package-manager=cargo&previous-version=4.5.28&new-version=4.5.34)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-31 21:00:21 +00:00
dependabot[bot]
5e21d07727 build(deps): bump windows-service from 0.7.0 to 0.8.0 in /rust (#8558)
Bumps [windows-service](https://github.com/mullvad/windows-service-rs)
from 0.7.0 to 0.8.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/mullvad/windows-service-rs/blob/main/CHANGELOG.md">windows-service's
changelog</a>.</em></p>
<blockquote>
<h2>[0.8.0] - 2025-02-19</h2>
<h3>Added</h3>
<ul>
<li>Add missing ServiceAccess flags <code>READ_CONTROL</code>,
<code>WRITE_DAC</code> and <code>WRITE_OWNER</code>.</li>
</ul>
<h3>Changed</h3>
<ul>
<li>Upgrade <code>windows-sys</code> dependency to 0.59 and bump the
MSRV to 1.60.0.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="ffaaf80ae3"><code>ffaaf80</code></a>
Bump version to 0.8.0 and add changelog</li>
<li><a
href="c6afc56e86"><code>c6afc56</code></a>
Bump windows-sys version to 0.59</li>
<li><a
href="96efa4ee71"><code>96efa4e</code></a>
Merge commit '9dc8af8'</li>
<li><a
href="9dc8af8513"><code>9dc8af8</code></a>
Add missing standard access rights</li>
<li>See full diff in <a
href="https://github.com/mullvad/windows-service-rs/compare/v0.7.0...v0.8.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=windows-service&package-manager=cargo&previous-version=0.7.0&new-version=0.8.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-31 20:59:21 +00:00
Thomas Eizinger
a4851ee76f feat(relay): implement the reverse IPv4 eBPF code path (#8544)
This PR implements the "reverse path" of handling TURN traffic, i.e. UDP
datagrams that arrive on an allocation port and need to be wrapped in a
channel-data message to be sent to the TURN client.

In order to achieve that, I had to rewrite most of the TURN code to not
use the `etherparse` crate. I couldn't quite figure out the details but
the eBPF verifier rejected my code in mysterious ways that I didn't
understand. Commenting out random code-paths seemed to make it happy but
all code-paths combined caused an error. Eventually, I decided that we
simply have to use less abstractions to implement the same logic.

All the "parsing" code is now using types inspired by `network-types`.
The only modification here is that we use byte-arrays within our structs
in order to directly receive them in big-endian ordering.
`network-types` uses `u16`s and `u32`s which get interpreted as
little-endian on x86. Instead of converting around between the
endianness, constructing those values where we want them using the right
endianness is deemed much simpler. I opened an issue with upstream which
- if accepted - will allow us to remove our own structs and instead
depend on upstream again.

I also had to aggressively add `#[inline(always)]` to several functions,
otherwise the compiler would not optimise away our function calls,
causing the linker and / or eBPF verifier to fail.

This PR also fixes numerous bugs that I've found in the already existing
eBPF code. The number of bugs makes me question how this has been
working so far at all!

- We did not swap the Ethernet source and destination MAC address when
re-routing the packet. The integration-test didn't catch this because it
only operates on the loopback interface. Further testing on staging
should allow us to confirm that this is indeed working now.
- The UDP checksum update did not incorporate the new src and dst port.
The integration-test didnt' catch that because it has UDP checksumming
disabled. We need to have that disabled in the test because UDP
checksumming is typically offloaded to the NIC and packets on the
loopback interface never leave the device.

Related: https://github.com/vadorovsky/network-types/issues/32.
Related: #7518
2025-03-31 12:32:35 +00:00
Thomas Eizinger
ae157bce12 fix(relay): turn regression tests back on (#8541)
As part of iterating on #8496, the API of `relay::Server` had changed
and I had commented out the regression tests to move quicker. In later
iterations, those API changes were reverted but I forgot to uncomment
them.
2025-03-31 08:55:26 +00:00
Thomas Eizinger
8a8d314038 build(rust): use upstream version of aya-build (#8545)
The PR we have been waiting on got merged.
2025-03-29 04:02:21 +00:00
Thomas Eizinger
afa6814ab4 chore(relay): ignore eBPF integration test (#8543)
This needs elevated privileges to run. Our current pattern for these is
to set them as ignored. In CI, we run all tests, including the ignored
ones.
2025-03-29 01:49:43 +00:00
Thomas Eizinger
e231ba9407 fix(relay): update aya-build dependency to latest version (#8540)
As part of working on https://github.com/aya-rs/aya/pull/1228, which I
am depending on in here I had to force-push which will break CI. Opening
this to fix it.
2025-03-29 00:12:14 +00:00
Thomas Eizinger
3c7ac084c0 feat(relay): MVP for routing channel data message in eBPF kernel (#8496)
## Abstract

This pull-request implements the first stage of off-loading routing of
TURN data channel messages to the kernel via an eBPF XDP program. In
particular, the eBPF kernel implemented here **only** handles the
decapsulation of IPv4 data channel messages into their embedded UDP
payload. Implementation of other data paths, such as the receiving of
UDP traffic on an allocation and wrapping it in a TURN channel data
message is deferred to a later point for reasons explained further down.
As it stands, this PR implements the bare minimum for us to start
experimenting and benefiting from eBPF. It is already massive as it is
due to the infrastructure required for actually doing this. Let's dive
into it!

## A refresher on TURN channel-data messages

TURN specifies a channel-data message for relaying data between two
peers. A channel data message has a fixed 4-byte header:

- The first two bytes specify the channel number
- The second two bytes specify the length of the encapsulated payload

Like all TURN traffic, channel data messages run over UDP by default,
meaning this header sits at the very front of the UDP payload. This will
be important later.

After making an allocation with a TURN server (i.e. reserving a port on
the TURN server's interfaces), a TURN client can bind channels on that
allocation. As such, channel numbers are scoped to a client's
allocation. Channel numbers are allocated by the client within a given
range (0x4000 - 0x4FFF). When binding a channel, the client specifies
the remote's peer address that they'd like the data sent on the channel
to be sent to.

Given this setup, when a TURN server receives a channel data message, it
first looks at the sender's IP + port to infer the allocation (a client
can only ever have 1 allocation at a time). Within that allocation, the
server then looks for the channel number and retrieves the target socket
address from that. The allocation itself is a port on the relay's
interface. With that, we can now "unpack" the payload of the channel
data message and rewrite it to the new receiver:

- The new source IP can be set from the old dst IP (when operating in
user-space mode this is irrelevant because we are working with the
socket API).
- The new source port is the client's allocation.
- The new destination IP is retrieved from the mapping retrieved via the
channel number.
- The new destination port is retrieved from the mapping retrieved via
the channel number.

Last but not least, all that is left is removing the channel data header
from the UDP payload and we can send out the packet. In other words, we
need to cut off the first 4 bytes of the UDP payload.

## User-space relaying

At present, we implement the above flow in user-space. This is tricky to
do because we need to bind _many_ sockets, one for each possible
allocation port (of which there can be 16383). The actual work to be
done on these packets is also extremely minimal. All we do is cut off
(or add on) the data-channel header. Benchmarks show that we spend
pretty much all of our time copying data between user-space and
kernel-space. Cutting this out should give us a massive increase in
performance.

## Implementing an eBPF XDP TURN router

eBPF has been shown to be a very efficient way of speeding up a TURN
server [0]. After many failed experiments (e.g. using TC instead of XDP)
and countless rabbit-holes, we have also arrived at the design
documented within the paper. Most notably:

- The eBPF program is entirely optional. We try to load it on startup,
but if that fails, we will simply use the user-space mode.
- Retaining the user-space mode is also important because under certain
circumstances, the eBPF kernel needs to pass on the packet, for example,
when receiving IPv4 packets with options. Those make the header
dynamically-sized which makes further processing difficult because the
eBPF verifier disallows indexing into the packet with data derived from
the packet itself.
- In order to add/remove the channel-data header, we shift the packet
headers backwards / forwards and leave the payload in place as the
packet headers are constant in size and can thus easily and cheaply be
copied out.

In order to perform the relaying flow explained above, we introduce maps
that are shared with user-space. These maps go from a tuple of
(client-socket, channel-number) to a tuple of (allocation-port,
peer-socket) and thus give us all the data necessary to rewrite the
packet.

## Integration with our relay

Last but not least, to actually integrate the eBPF kernel with our
relay, we need to extend the `Server` with two more events so we can
learn, when channel bindings are created and when they expire. Using
these events, we can then update the eBPF maps accordingly and therefore
influence the routing behaviour in the kernel.

## Scope

What is implemented here is only one of several possible data paths.
Implementing the others isn't conceptually difficult but it does
increase the scope. Landing something that already works allows us to
gain experience running it in staging (and possibly production).
Additionally, I've hit some issues with the eBPF verifier when adding
more codepaths to the kernel. I expect those to be possible to resolve
given sufficient debugging but I'd like to do so after merging this.

---

Depends-On: #8506
Depends-On: #8507
Depends-On: #8500
Resolves: #8501

[0]: https://dl.acm.org/doi/pdf/10.1145/3609021.3609296
2025-03-27 10:59:40 +00:00
Thomas Eizinger
19c5bc530a feat(gateway): deprecate the NAT64 module (#8383)
At present, the Gateway implements a NAT64 conversion that can convert
IPv4 packets to IPv6 and vice versa. Doing this efficiently creates a
fair amount of complexity within our `ip-packet` crate. In addition,
routing ICMP errors back through our NAT is also complicated by this
because we may have to translate the packet embedded in the ICMP error
as well.

The NAT64 module was originally conceived as a result of the new stub
resolver-based DNS architecture. When the Client resolves IPs for a
domain, it doesn't know whether the domain will actually resolve to IPv4
AND IPv6 addresses so it simply assigns 4 of each to every domain. Thus,
when receiving an IPv6 packet for such a DNS resource, the Gateway may
only have IPv4 addresses available and can therefore not route the
packet (unless it translates it).

This problem is not novel. In fact, an IP being unroutable or a
particular route disappearing happens all the time on the Internet. ICMP
was conceived to handle this problem and it is doing a pretty good job
at it. We can make use of that and simply return an ICMP unreachable
error back to the client whenever it picks an IP that we cannot map to
one that we resolved.

In this PR, we leave all of the NAT64 code intact and only add a
feature-flag that - when active - sends aforementioned ICMP error. While
offline (and thus also for our tests), the feature-flag evaluates to
false. It is however set to `true` in the backend, meaning on staging
and later in production, we will send these ICMP errors.

Once this is rolled out and indeed proving to be working as intended, we
can simplify our codebase and rip out the NAT64 module. At that point,
we will also have to adapt the test-suite.
2025-03-27 01:01:37 +00:00
Thomas Eizinger
aa957be538 fix(connlib): only disable not-yet-disabled resources (#8525)
Didn't test this but I think the logic checks out (and our proptests
should catch any bugs here).

Fixes: #8523
2025-03-27 00:36:39 +00:00
Thomas Eizinger
f13234955a refactor(gui-client): simplify error handling (#8519)
As a follow-up from #7959, we can now simplify the error handling a fair
bit as all codepaths that can fail in the client are threaded back to
the main function.
2025-03-26 21:39:26 +00:00
Thomas Eizinger
58fe527b0e feat(connlib): mirror ECN bits on TUN device (#8511)
From the perspective of any application, Firezone is a layer-3 network
and will thus use the host's networking stack to form IP packets for
whichever application protocol is in use (UDP, TCP, etc). These packets
then get encapsulated into UDP packets by Firezone and sent to a
Gateway.

As a result of this design, the IP header seen by the networking stacks
of the Client and the receiving service are not visible to any
intermediary along the network path of the Client and Gateway.

In case this network path is congested and middleboxes such as routers
need to drop packets, they will look at the ECN bits in the IP header
(of the UDP packet generated by a Client or Gateway) and flip a bit in
case the previous value indicated support for ECN (`0x01` or `0x10`).
When received by a network stack that supports ECN, seeing `0x11` means
that the network path is congested and that it must reduce its
send/receive windows (or otherwise throttle the connection).

At present, this doesn't work with Firezone because of the
aforementioned encapsulation of IP packets. To support ECN, we need to
therefore:

- Copy ECN bits from a received IP packet to the datagram that
encapsulates it: This ensures that if the Client's network stack support
ECN, we mirror that support on the wire.
- Copy ECN bits from a received datagram to the IP packet the is sent to
the TUN device: This ensures that if the "Congestion Experienced" bit
get set along the network path between Client and Gateway, we reflect
that accordingly on the IP packet emitted by the TUN device.

Resolves: #3758

---------

Signed-off-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Jamil Bou Kheir <jamilbk@users.noreply.github.com>
2025-03-26 20:55:51 +00:00
Thomas Eizinger
41d89f4c12 fix(connlib): don't clear DnsResourceNatState::Pending (#8521)
When we receive a DNS query for a resource, we refresh the DNS resource
NAT on the Gateway by clearing the local state. This ensures that if any
of the DNS records have changed, those will be reflected in the new NAT
table on the Gateway.

I cannot fully confirm my theory but I have a hunch that under certain
circumstances, this would lead to loss of buffered packets which lead to
connections getting reset. I couldn't confirm that in my testing though.
The issues I experienced with github.com suddenly stopped
🙃
2025-03-26 17:56:33 +00:00
dependabot[bot]
75da4806ea build(deps-dev): bump vite from 6.2.0 to 6.2.3 in /rust/gui-client in the npm_and_yarn group (#8517)
Bumps the npm_and_yarn group in /rust/gui-client with 1 update:
[vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite).

Updates `vite` from 6.2.0 to 6.2.3
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/vitejs/vite/releases">vite's
releases</a>.</em></p>
<blockquote>
<h2>v6.2.3</h2>
<p>Please refer to <a
href="https://github.com/vitejs/vite/blob/v6.2.3/packages/vite/CHANGELOG.md">CHANGELOG.md</a>
for details.</p>
<h2>v6.2.2</h2>
<p>Please refer to <a
href="https://github.com/vitejs/vite/blob/v6.2.2/packages/vite/CHANGELOG.md">CHANGELOG.md</a>
for details.</p>
<h2>create-vite@6.2.1</h2>
<p>Please refer to <a
href="https://github.com/vitejs/vite/blob/create-vite@6.2.1/packages/create-vite/CHANGELOG.md">CHANGELOG.md</a>
for details.</p>
<h2>v6.2.1</h2>
<p>Please refer to <a
href="https://github.com/vitejs/vite/blob/v6.2.1/packages/vite/CHANGELOG.md">CHANGELOG.md</a>
for details.</p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/vitejs/vite/blob/v6.2.3/packages/vite/CHANGELOG.md">vite's
changelog</a>.</em></p>
<blockquote>
<h2><!-- raw HTML omitted -->6.2.3 (2025-03-24)<!-- raw HTML omitted
--></h2>
<ul>
<li>fix: fs raw query with query separators (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19702">#19702</a>)
(<a
href="f234b5744d">f234b57</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/19702">#19702</a></li>
</ul>
<h2><!-- raw HTML omitted -->6.2.2 (2025-03-14)<!-- raw HTML omitted
--></h2>
<ul>
<li>fix: await client buildStart on top level buildStart (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19624">#19624</a>)
(<a
href="b31faab2a8">b31faab</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/19624">#19624</a></li>
<li>fix(css): inline css correctly for double quote use strict (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19590">#19590</a>)
(<a
href="d0aa833296">d0aa833</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/19590">#19590</a></li>
<li>fix(deps): update all non-major dependencies (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19613">#19613</a>)
(<a
href="363d691b49">363d691</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/19613">#19613</a></li>
<li>fix(indexHtml): ensure correct URL when querying module graph (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19601">#19601</a>)
(<a
href="dc5395a27e">dc5395a</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/19601">#19601</a></li>
<li>fix(preview): use preview https config, not server (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19633">#19633</a>)
(<a
href="98b3160fa5">98b3160</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/19633">#19633</a></li>
<li>fix(ssr): use optional chaining to prevent &quot;undefined is not an
object&quot; happening in `ssrRewriteStac (<a
href="43097550a1">4309755</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/19612">#19612</a></li>
<li>feat: show friendly error for malformed <code>base</code> (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19616">#19616</a>)
(<a
href="2476391b28">2476391</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/19616">#19616</a></li>
<li>feat(worker): show asset filename conflict warning (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19591">#19591</a>)
(<a
href="367d968fbf">367d968</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/19591">#19591</a></li>
<li>chore: extend commit hash correctly when ambigious with a non-commit
object (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19600">#19600</a>)
(<a
href="89a6287324">89a6287</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/19600">#19600</a></li>
</ul>
<h2><!-- raw HTML omitted -->6.2.1 (2025-03-07)<!-- raw HTML omitted
--></h2>
<ul>
<li>refactor: remove <code>isBuild</code> check from preAliasPlugin (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19587">#19587</a>)
(<a
href="c9e086d35a">c9e086d</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/19587">#19587</a></li>
<li>refactor: restore endsWith usage (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19554">#19554</a>)
(<a
href="6113a9670c">6113a96</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/19554">#19554</a></li>
<li>refactor: use <code>applyToEnvironment</code> in internal plugins
(<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19588">#19588</a>)
(<a
href="f678442d57">f678442</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/19588">#19588</a></li>
<li>fix(css): stabilize css module hashes with lightningcss in dev mode
(<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19481">#19481</a>)
(<a
href="92125b41e4">92125b4</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/19481">#19481</a></li>
<li>fix(deps): update all non-major dependencies (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19555">#19555</a>)
(<a
href="f612e0fdf6">f612e0f</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/19555">#19555</a></li>
<li>fix(reporter): fix incorrect bundle size calculation with non-ASCII
characters (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19561">#19561</a>)
(<a
href="437c0ed8ba">437c0ed</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/19561">#19561</a></li>
<li>fix(sourcemap): combine sourcemaps with multiple sources without
matched source (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/18971">#18971</a>)
(<a
href="e3f6ae14f7">e3f6ae1</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/18971">#18971</a></li>
<li>fix(ssr): named export should overwrite export all (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19534">#19534</a>)
(<a
href="2fd2fc1107">2fd2fc1</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/19534">#19534</a></li>
<li>feat: add <code>*?url&amp;no-inline</code> type and warning for
<code>.json?inline</code> / <code>.json?no-inline</code> (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19566">#19566</a>)
(<a
href="c0d36677cd">c0d3667</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/19566">#19566</a></li>
<li>test: add glob import test case (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19516">#19516</a>)
(<a
href="aa1d8075cc">aa1d807</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/19516">#19516</a></li>
<li>test: convert config playground to unit tests (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19568">#19568</a>)
(<a
href="c0e68da477">c0e68da</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/19568">#19568</a></li>
<li>test: convert resolve-config playground to unit tests (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19567">#19567</a>)
(<a
href="db5fb48f5d">db5fb48</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/19567">#19567</a></li>
<li>perf: flush compile cache after 10s (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19537">#19537</a>)
(<a
href="6c8a5a27e6">6c8a5a2</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/19537">#19537</a></li>
<li>chore(css): move environment destructuring after condition check (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19492">#19492</a>)
(<a
href="c9eda2348c">c9eda23</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/19492">#19492</a></li>
<li>chore(html): remove unnecessary value check (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19491">#19491</a>)
(<a
href="797959f01d">797959f</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/19491">#19491</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="16869d7c99"><code>16869d7</code></a>
release: v6.2.3</li>
<li><a
href="f234b5744d"><code>f234b57</code></a>
fix: fs raw query with query separators (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19702">#19702</a>)</li>
<li><a
href="b12911edba"><code>b12911e</code></a>
release: v6.2.2</li>
<li><a
href="98b3160fa5"><code>98b3160</code></a>
fix(preview): use preview https config, not server (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19633">#19633</a>)</li>
<li><a
href="b31faab2a8"><code>b31faab</code></a>
fix: await client buildStart on top level buildStart (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19624">#19624</a>)</li>
<li><a
href="dc5395a27e"><code>dc5395a</code></a>
fix(indexHtml): ensure correct URL when querying module graph (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19601">#19601</a>)</li>
<li><a
href="2476391b28"><code>2476391</code></a>
feat: show friendly error for malformed <code>base</code> (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19616">#19616</a>)</li>
<li><a
href="43097550a1"><code>4309755</code></a>
fix(ssr): use optional chaining to prevent &quot;undefined is not an
object&quot; happe...</li>
<li><a
href="363d691b49"><code>363d691</code></a>
fix(deps): update all non-major dependencies (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19613">#19613</a>)</li>
<li><a
href="d0aa833296"><code>d0aa833</code></a>
fix(css): inline css correctly for double quote use strict (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/19590">#19590</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/vitejs/vite/commits/v6.2.3/packages/vite">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=vite&package-manager=npm_and_yarn&previous-version=6.2.0&new-version=6.2.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/firezone/firezone/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-26 00:23:49 +00:00
Thomas Eizinger
d1d0874699 refactor(rust): introduce etherparse-ext crate (#8500)
Within Firezone's Rust codebase, we use the `etherparse` crate
extensively to parse network packets. To provide a more ergonomic API,
this is all encapsulated in our `ip-packet` crate.

For #7518, we need to write an eBPF kernel that parses and manipulates
network packets. Etherparse itself doesn't provide any facilities to
manipulate network packets. That is an open feature request:
https://github.com/JulianSchmid/etherparse/issues/9. For the packet
manipulation that we are doing in `connlib`, we already wrote certain
extensions to the `etherparse` crate but today, those are all within the
`ip-packet` crate.

In order to reuse that within the eBPF kernel, we cannot just depend on
`ip-packet` directly because eBPF is a no-std and no-alloc environment,
thus no crate in the dependency tree is allowed to depend on Rust's
std-lib. `etherparse` itself actually has an `std` feature flag that we
can turn off. Introducing the same in `ip-packet` would require a lot of
conditional-compilation gates using `#[cfg]`. it is much easier to just
introduce a new crate that houses all our in-house extensions to
`etherparse`. Eventually, we can hopefully upstream those which is
another motivator to separate this out.
2025-03-25 22:33:14 +00:00
Thomas Eizinger
a9864e5bd0 refactor(rust): tell Tauri to use our existing runtime (#8514)
Tauri needs a tokio runtime in order to spawn tasks. If we don't supply
one, it will start its own runtime. Given that we already start a
runtime, this is unnecessary.
2025-03-25 15:50:25 +00:00
Thomas Eizinger
bc1b788781 fix(rust): remove exceptions of duplicated dependencies (#8505)
These are no longer duplicates in our dependency tree.
2025-03-25 13:17:05 +00:00
Thomas Eizinger
c31c2ef56d refactor(gui-client): gracefully exit Tauri app (#7959)
At present, the Windows and Linux GUI client launch the Tauri
application via the `App::run` method. This function never returns
again. Instead, whenever we request the Tauri app to exit, Tauri will
internally call `std::process::exit`, thus preventing ordinary clean-up
from happening.

Whilst we somehow managed to work around this particular part, having
the app exit the process internally also makes error handling and
reporting to the user difficult as there are now two parts in the code
where we need to handle errors:

- Before we start up the Tauri app
- Before we end the Tauri app (i.e. signal to it that we want to exit)

It would be much easier to understand, if we could call into Tauri, let
it do its thing and upon a requested exit by the user, the called
function (i.e. `App::run`) simply returns again. After diving into the
inner workings of Tauri, we have achieved just that by adding a new
function to `App`: `App::run_return`
(https://github.com/tauri-apps/tauri/pull/12668). Using
`App::run_return` we can now orchestrate a `gui::run` function that
simply returns after Tauri has shutdown. Most importantly, it will also
exit upon any fatal errors that we encounter in the controller and thus
unify the error handling path into a single one. These errors are now
all handled at the call-site of `gui::run`.

Building on top of this, we will be able to further simplify the error
handling within the GUI client. I am hoping to gradually replace our
monolithic `Error` enums with individual errors that we can extract from
an `anyhow::Error`. This would make it easier to reason about where
certain errors get generated and thus overall improve the UX of the
application by displaying better error messages, not failing the entire
app in certain cases, etc.
2025-03-25 09:55:33 +00:00
dependabot[bot]
d4338883a6 build(deps): bump semver from 1.0.25 to 1.0.26 in /rust (#8509)
Bumps [semver](https://github.com/dtolnay/semver) from 1.0.25 to 1.0.26.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/dtolnay/semver/releases">semver's
releases</a>.</em></p>
<blockquote>
<h2>1.0.26</h2>
<ul>
<li>Documentation improvements</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="3e64fdbfce"><code>3e64fdb</code></a>
Release 1.0.26</li>
<li><a
href="dd8dc0ad90"><code>dd8dc0a</code></a>
Point standard library links to stable</li>
<li><a
href="479518de59"><code>479518d</code></a>
Unset doc-scrape-examples for lib target</li>
<li><a
href="4fa7acb318"><code>4fa7acb</code></a>
More precise gitignore patterns</li>
<li>See full diff in <a
href="https://github.com/dtolnay/semver/compare/1.0.25...1.0.26">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=semver&package-manager=cargo&previous-version=1.0.25&new-version=1.0.26)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-24 20:57:05 +00:00
dependabot[bot]
9307e173f5 build(deps): bump uuid from 1.14.0 to 1.16.0 in /rust (#8510)
Bumps [uuid](https://github.com/uuid-rs/uuid) from 1.14.0 to 1.16.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/uuid-rs/uuid/releases">uuid's
releases</a>.</em></p>
<blockquote>
<h2>v1.16.0</h2>
<h2>What's Changed</h2>
<ul>
<li>Mark <code>Uuid::new_v8</code> const by <a
href="https://github.com/tguichaoua"><code>@​tguichaoua</code></a> in <a
href="https://redirect.github.com/uuid-rs/uuid/pull/815">uuid-rs/uuid#815</a></li>
<li>Prepare for 1.16.0 release by <a
href="https://github.com/KodrAus"><code>@​KodrAus</code></a> in <a
href="https://redirect.github.com/uuid-rs/uuid/pull/817">uuid-rs/uuid#817</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a
href="https://github.com/tguichaoua"><code>@​tguichaoua</code></a> made
their first contribution in <a
href="https://redirect.github.com/uuid-rs/uuid/pull/815">uuid-rs/uuid#815</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/uuid-rs/uuid/compare/v1.15.1...v1.16.0">https://github.com/uuid-rs/uuid/compare/v1.15.1...v1.16.0</a></p>
<h2>v1.15.1</h2>
<h2>What's Changed</h2>
<ul>
<li>Guarantee v7 timestamp will never overflow by <a
href="https://github.com/KodrAus"><code>@​KodrAus</code></a> in <a
href="https://redirect.github.com/uuid-rs/uuid/pull/811">uuid-rs/uuid#811</a></li>
<li>Prepare for 1.15.1 release by <a
href="https://github.com/KodrAus"><code>@​KodrAus</code></a> in <a
href="https://redirect.github.com/uuid-rs/uuid/pull/812">uuid-rs/uuid#812</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/uuid-rs/uuid/compare/v1.15.0...v1.15.1">https://github.com/uuid-rs/uuid/compare/v1.15.0...v1.15.1</a></p>
<h2>v1.15.0</h2>
<h2>What's Changed</h2>
<ul>
<li>Add a manual <code>Debug</code> implementation for NonNilUUid by <a
href="https://github.com/rick-de-water"><code>@​rick-de-water</code></a>
in <a
href="https://redirect.github.com/uuid-rs/uuid/pull/808">uuid-rs/uuid#808</a></li>
<li>Support higher precision, shiftable timestamps in V7 UUIDs by <a
href="https://github.com/KodrAus"><code>@​KodrAus</code></a> in <a
href="https://redirect.github.com/uuid-rs/uuid/pull/809">uuid-rs/uuid#809</a></li>
<li>Prepare for 1.15.0 release by <a
href="https://github.com/KodrAus"><code>@​KodrAus</code></a> in <a
href="https://redirect.github.com/uuid-rs/uuid/pull/810">uuid-rs/uuid#810</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a
href="https://github.com/rick-de-water"><code>@​rick-de-water</code></a>
made their first contribution in <a
href="https://redirect.github.com/uuid-rs/uuid/pull/808">uuid-rs/uuid#808</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/uuid-rs/uuid/compare/v1.14.0...v1.15.0">https://github.com/uuid-rs/uuid/compare/v1.14.0...v1.15.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="c36beb14d5"><code>c36beb1</code></a>
Merge pull request <a
href="https://redirect.github.com/uuid-rs/uuid/issues/817">#817</a> from
uuid-rs/cargo/v1.16.0</li>
<li><a
href="5338b246b7"><code>5338b24</code></a>
prepare for 1.16.0 release</li>
<li><a
href="420f6279ae"><code>420f627</code></a>
Merge pull request <a
href="https://redirect.github.com/uuid-rs/uuid/issues/815">#815</a> from
tguichaoua/new_v8_const</li>
<li><a
href="254258c8c7"><code>254258c</code></a>
mark <code>Uuid::new_v8</code> const</li>
<li><a
href="4e5b88e7af"><code>4e5b88e</code></a>
Merge pull request <a
href="https://redirect.github.com/uuid-rs/uuid/issues/812">#812</a> from
uuid-rs/cargo/v1.15.1</li>
<li><a
href="7fb64f78c7"><code>7fb64f7</code></a>
prepare for 1.15.1 release</li>
<li><a
href="f05b6df98e"><code>f05b6df</code></a>
Merge pull request <a
href="https://redirect.github.com/uuid-rs/uuid/issues/811">#811</a> from
uuid-rs/fix/v7-overflow</li>
<li><a
href="c2d313fbbb"><code>c2d313f</code></a>
guarantee v7 timestamp will never overflow</li>
<li><a
href="56ba68ff13"><code>56ba68f</code></a>
Merge pull request <a
href="https://redirect.github.com/uuid-rs/uuid/issues/810">#810</a> from
uuid-rs/cargo/v1.15.0</li>
<li><a
href="26c8a9bebc"><code>26c8a9b</code></a>
prepare for 1.15.0 release</li>
<li>Additional commits viewable in <a
href="https://github.com/uuid-rs/uuid/compare/v1.14.0...v1.16.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=uuid&package-manager=cargo&previous-version=1.14.0&new-version=1.16.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-24 20:56:42 +00:00
Jamil
effe169414 chore: release apple 1.4.8 (#8499)
Introduces the autoconnect and session end fixes.
2025-03-21 11:43:00 +00:00
Jamil
91db00f3d7 fix(gateway): Apply more specific firewall rules on start (#8483)
On some Linux distributions (Amazon Linux 2023), the default `iptables`
install includes a blanket deny rule in the `FORWARD` chain that
prevents packets from the tunnel interface from ever leaving the host.
To fix this, we ensure our `FORWARD` chain rules are inserted with
priority 1 which takes precedence over the blanket-deny rule.

We also update our MASQUERADE in the NAT table to apply only to the CIDR
range possible for Gateway tunnel IPs, as opposed to the default
`0.0.0.0/0`.

Fixes #8481
2025-03-19 05:32:50 +00:00
Thomas Eizinger
84a2c275ca build(rust): upgrade to Rust 1.85 and Edition 2024 (#8240)
Updates our codebase to the 2024 Edition. For highlights on what
changes, see the following blogpost:
https://blog.rust-lang.org/2025/02/20/Rust-1.85.0.html
2025-03-19 02:58:55 +00:00
dependabot[bot]
64e4a51510 build(deps): bump android_log-sys from 0.3.1 to 0.3.2 in /rust (#8465)
Bumps
[android_log-sys](https://github.com/rust-mobile/android_log-sys-rs)
from 0.3.1 to 0.3.2.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/rust-mobile/android_log-sys-rs/commits">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=android_log-sys&package-manager=cargo&previous-version=0.3.1&new-version=0.3.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-18 21:39:25 +00:00
dependabot[bot]
2bcd26d3de build(deps): bump libc from 0.2.169 to 0.2.171 in /rust (#8466)
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.169 to 0.2.171.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/rust-lang/libc/releases">libc's
releases</a>.</em></p>
<blockquote>
<h2>0.2.171</h2>
<h3>Added</h3>
<ul>
<li>Android: Add <code>if_nameindex</code>/<code>if_freenameindex</code>
support (<a
href="https://redirect.github.com/rust-lang/libc/pull/4247">#4247</a>)</li>
<li>Apple: Add missing proc types and constants (<a
href="https://redirect.github.com/rust-lang/libc/pull/4310">#4310</a>)</li>
<li>BSD: Add <code>devname</code> (<a
href="https://redirect.github.com/rust-lang/libc/pull/4285">#4285</a>)</li>
<li>Cygwin: Add PTY and group API (<a
href="https://redirect.github.com/rust-lang/libc/pull/4309">#4309</a>)</li>
<li>Cygwin: Add support (<a
href="https://redirect.github.com/rust-lang/libc/pull/4279">#4279</a>)</li>
<li>FreeBSD: Make <code>spawn.h</code> interfaces available on all
FreeBSD-like systems (<a
href="https://redirect.github.com/rust-lang/libc/pull/4294">#4294</a>)</li>
<li>Linux: Add <code>AF_XDP</code> structs for all Linux environments
(<a
href="https://redirect.github.com/rust-lang/libc/pull/4163">#4163</a>)</li>
<li>Linux: Add SysV semaphore constants (<a
href="https://redirect.github.com/rust-lang/libc/pull/4286">#4286</a>)</li>
<li>Linux: Add <code>F_SEAL_EXEC</code> (<a
href="https://redirect.github.com/rust-lang/libc/pull/4316">#4316</a>)</li>
<li>Linux: Add <code>SO_PREFER_BUSY_POLL</code> and
<code>SO_BUSY_POLL_BUDGET</code> (<a
href="https://redirect.github.com/rust-lang/libc/pull/3917">#3917</a>)</li>
<li>Linux: Add <code>devmem</code> structs (<a
href="https://redirect.github.com/rust-lang/libc/pull/4299">#4299</a>)</li>
<li>Linux: Add socket constants up to <code>SO_DEVMEM_DONTNEED</code>
(<a
href="https://redirect.github.com/rust-lang/libc/pull/4299">#4299</a>)</li>
<li>NetBSD, OpenBSD, DragonflyBSD: Add <code>closefrom</code> (<a
href="https://redirect.github.com/rust-lang/libc/pull/4290">#4290</a>)</li>
<li>NuttX: Add <code>pw_passwd</code> field to <code>passwd</code> (<a
href="https://redirect.github.com/rust-lang/libc/pull/4222">#4222</a>)</li>
<li>Solarish: define <code>IP_BOUND_IF</code> and
<code>IPV6_BOUND_IF</code> (<a
href="https://redirect.github.com/rust-lang/libc/pull/4287">#4287</a>)</li>
<li>Wali: Add bindings for <code>wasm32-wali-linux-musl</code> target
(<a
href="https://redirect.github.com/rust-lang/libc/pull/4244">#4244</a>)</li>
</ul>
<h3>Changed</h3>
<ul>
<li>AIX: Use <code>sa_sigaction</code> instead of a union (<a
href="https://redirect.github.com/rust-lang/libc/pull/4250">#4250</a>)</li>
<li>Make <code>msqid_ds.__msg_cbytes</code> public (<a
href="https://redirect.github.com/rust-lang/libc/pull/4301">#4301</a>)</li>
<li>Unix: Make all <code>major</code>, <code>minor</code>,
<code>makedev</code> into <code>const fn</code> (<a
href="https://redirect.github.com/rust-lang/libc/pull/4208">#4208</a>)</li>
</ul>
<h3>Deprecated</h3>
<ul>
<li>Linux: Deprecate obsolete packet filter interfaces (<a
href="https://redirect.github.com/rust-lang/libc/pull/4267">#4267</a>)</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>Cygwin: Fix strerror_r (<a
href="https://redirect.github.com/rust-lang/libc/pull/4308">#4308</a>)</li>
<li>Cygwin: Fix usage of f! (<a
href="https://redirect.github.com/rust-lang/libc/pull/4308">#4308</a>)</li>
<li>Hermit: Make <code>stat::st_size</code> signed (<a
href="https://redirect.github.com/rust-lang/libc/pull/4298">#4298</a>)</li>
<li>Linux: Correct values for <code>SI_TIMER</code>,
<code>SI_MESGQ</code>, <code>SI_ASYNCIO</code> (<a
href="https://redirect.github.com/rust-lang/libc/pull/4292">#4292</a>)</li>
<li>NuttX: Update <code>tm_zone</code> and <code>d_name</code> fields to
use <code>c_char</code> type (<a
href="https://redirect.github.com/rust-lang/libc/pull/4222">#4222</a>)</li>
<li>Xous: Include the prelude to define <code>c_int</code> (<a
href="https://redirect.github.com/rust-lang/libc/pull/4304">#4304</a>)</li>
</ul>
<h3>Other</h3>
<ul>
<li>Add labels to FIXMEs (<a
href="https://redirect.github.com/rust-lang/libc/pull/4231">#4231</a>,
<a
href="https://redirect.github.com/rust-lang/libc/pull/4232">#4232</a>,
<a
href="https://redirect.github.com/rust-lang/libc/pull/4234">#4234</a>,
<a
href="https://redirect.github.com/rust-lang/libc/pull/4235">#4235</a>,
<a
href="https://redirect.github.com/rust-lang/libc/pull/4236">#4236</a>)</li>
<li>CI: Fix &quot;cannot find libc&quot; error on Sparc64 (<a
href="https://redirect.github.com/rust-lang/libc/pull/4317">#4317</a>)</li>
<li>CI: Fix &quot;cannot find libc&quot; error on s390x (<a
href="https://redirect.github.com/rust-lang/libc/pull/4317">#4317</a>)</li>
<li>CI: Pass <code>--no-self-update</code> to <code>rustup update</code>
(<a
href="https://redirect.github.com/rust-lang/libc/pull/4306">#4306</a>)</li>
<li>CI: Remove tests for the <code>i586-pc-windows-msvc</code> target
(<a
href="https://redirect.github.com/rust-lang/libc/pull/4311">#4311</a>)</li>
<li>CI: Remove the <code>check_cfg</code> job (<a
href="https://redirect.github.com/rust-lang/libc/pull/4312">#4322</a>)</li>
<li>Change the range syntax that is giving <code>ctest</code> problems
(<a
href="https://redirect.github.com/rust-lang/libc/pull/4311">#4311</a>)</li>
<li>Linux: Split out the stat struct for gnu/b32/mips (<a
href="https://redirect.github.com/rust-lang/libc/pull/4276">#4276</a>)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/rust-lang/libc/blob/0.2.171/CHANGELOG.md">libc's
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/rust-lang/libc/compare/0.2.170...0.2.171">0.2.171</a>
- 2025-03-11</h2>
<h3>Added</h3>
<ul>
<li>Android: Add <code>if_nameindex</code>/<code>if_freenameindex</code>
support (<a
href="https://redirect.github.com/rust-lang/libc/pull/4247">#4247</a>)</li>
<li>Apple: Add missing proc types and constants (<a
href="https://redirect.github.com/rust-lang/libc/pull/4310">#4310</a>)</li>
<li>BSD: Add <code>devname</code> (<a
href="https://redirect.github.com/rust-lang/libc/pull/4285">#4285</a>)</li>
<li>Cygwin: Add PTY and group API (<a
href="https://redirect.github.com/rust-lang/libc/pull/4309">#4309</a>)</li>
<li>Cygwin: Add support (<a
href="https://redirect.github.com/rust-lang/libc/pull/4279">#4279</a>)</li>
<li>FreeBSD: Make <code>spawn.h</code> interfaces available on all
FreeBSD-like systems (<a
href="https://redirect.github.com/rust-lang/libc/pull/4294">#4294</a>)</li>
<li>Linux: Add <code>AF_XDP</code> structs for all Linux environments
(<a
href="https://redirect.github.com/rust-lang/libc/pull/4163">#4163</a>)</li>
<li>Linux: Add SysV semaphore constants (<a
href="https://redirect.github.com/rust-lang/libc/pull/4286">#4286</a>)</li>
<li>Linux: Add <code>F_SEAL_EXEC</code> (<a
href="https://redirect.github.com/rust-lang/libc/pull/4316">#4316</a>)</li>
<li>Linux: Add <code>SO_PREFER_BUSY_POLL</code> and
<code>SO_BUSY_POLL_BUDGET</code> (<a
href="https://redirect.github.com/rust-lang/libc/pull/3917">#3917</a>)</li>
<li>Linux: Add <code>devmem</code> structs (<a
href="https://redirect.github.com/rust-lang/libc/pull/4299">#4299</a>)</li>
<li>Linux: Add socket constants up to <code>SO_DEVMEM_DONTNEED</code>
(<a
href="https://redirect.github.com/rust-lang/libc/pull/4299">#4299</a>)</li>
<li>NetBSD, OpenBSD, DragonflyBSD: Add <code>closefrom</code> (<a
href="https://redirect.github.com/rust-lang/libc/pull/4290">#4290</a>)</li>
<li>NuttX: Add <code>pw_passwd</code> field to <code>passwd</code> (<a
href="https://redirect.github.com/rust-lang/libc/pull/4222">#4222</a>)</li>
<li>Solarish: define <code>IP_BOUND_IF</code> and
<code>IPV6_BOUND_IF</code> (<a
href="https://redirect.github.com/rust-lang/libc/pull/4287">#4287</a>)</li>
<li>Wali: Add bindings for <code>wasm32-wali-linux-musl</code> target
(<a
href="https://redirect.github.com/rust-lang/libc/pull/4244">#4244</a>)</li>
</ul>
<h3>Changed</h3>
<ul>
<li>AIX: Use <code>sa_sigaction</code> instead of a union (<a
href="https://redirect.github.com/rust-lang/libc/pull/4250">#4250</a>)</li>
<li>Make <code>msqid_ds.__msg_cbytes</code> public (<a
href="https://redirect.github.com/rust-lang/libc/pull/4301">#4301</a>)</li>
<li>Unix: Make all <code>major</code>, <code>minor</code>,
<code>makedev</code> into <code>const fn</code> (<a
href="https://redirect.github.com/rust-lang/libc/pull/4208">#4208</a>)</li>
</ul>
<h3>Deprecated</h3>
<ul>
<li>Linux: Deprecate obsolete packet filter interfaces (<a
href="https://redirect.github.com/rust-lang/libc/pull/4267">#4267</a>)</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>Cygwin: Fix strerror_r (<a
href="https://redirect.github.com/rust-lang/libc/pull/4308">#4308</a>)</li>
<li>Cygwin: Fix usage of f! (<a
href="https://redirect.github.com/rust-lang/libc/pull/4308">#4308</a>)</li>
<li>Hermit: Make <code>stat::st_size</code> signed (<a
href="https://redirect.github.com/rust-lang/libc/pull/4298">#4298</a>)</li>
<li>Linux: Correct values for <code>SI_TIMER</code>,
<code>SI_MESGQ</code>, <code>SI_ASYNCIO</code> (<a
href="https://redirect.github.com/rust-lang/libc/pull/4292">#4292</a>)</li>
<li>NuttX: Update <code>tm_zone</code> and <code>d_name</code> fields to
use <code>c_char</code> type (<a
href="https://redirect.github.com/rust-lang/libc/pull/4222">#4222</a>)</li>
<li>Xous: Include the prelude to define <code>c_int</code> (<a
href="https://redirect.github.com/rust-lang/libc/pull/4304">#4304</a>)</li>
</ul>
<h3>Other</h3>
<ul>
<li>Add labels to FIXMEs (<a
href="https://redirect.github.com/rust-lang/libc/pull/4231">#4231</a>,
<a
href="https://redirect.github.com/rust-lang/libc/pull/4232">#4232</a>,
<a
href="https://redirect.github.com/rust-lang/libc/pull/4234">#4234</a>,
<a
href="https://redirect.github.com/rust-lang/libc/pull/4235">#4235</a>,
<a
href="https://redirect.github.com/rust-lang/libc/pull/4236">#4236</a>)</li>
<li>CI: Fix &quot;cannot find libc&quot; error on Sparc64 (<a
href="https://redirect.github.com/rust-lang/libc/pull/4317">#4317</a>)</li>
<li>CI: Fix &quot;cannot find libc&quot; error on s390x (<a
href="https://redirect.github.com/rust-lang/libc/pull/4317">#4317</a>)</li>
<li>CI: Pass <code>--no-self-update</code> to <code>rustup update</code>
(<a
href="https://redirect.github.com/rust-lang/libc/pull/4306">#4306</a>)</li>
<li>CI: Remove tests for the <code>i586-pc-windows-msvc</code> target
(<a
href="https://redirect.github.com/rust-lang/libc/pull/4311">#4311</a>)</li>
<li>CI: Remove the <code>check_cfg</code> job (<a
href="https://redirect.github.com/rust-lang/libc/pull/4312">#4322</a>)</li>
<li>Change the range syntax that is giving <code>ctest</code> problems
(<a
href="https://redirect.github.com/rust-lang/libc/pull/4311">#4311</a>)</li>
<li>Linux: Split out the stat struct for gnu/b32/mips (<a
href="https://redirect.github.com/rust-lang/libc/pull/4276">#4276</a>)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="78b0f8a739"><code>78b0f8a</code></a>
chore: release v0.2.171</li>
<li><a
href="b988ca5bbe"><code>b988ca5</code></a>
Merge pull request <a
href="https://redirect.github.com/rust-lang/libc/issues/4318">#4318</a>
from tgross35/backport-morel</li>
<li><a
href="5746f8e490"><code>5746f8e</code></a>
Add missing macos proc types and constants</li>
<li><a
href="29a40e2cac"><code>29a40e2</code></a>
linux: add devmem structs</li>
<li><a
href="85f6836e3b"><code>85f6836</code></a>
linux: add socket constants up to SO_DEVMEM_DONTNEED</li>
<li><a
href="ff17476460"><code>ff17476</code></a>
linux_like: add F_SEAL_EXEC</li>
<li><a
href="67352ee823"><code>67352ee</code></a>
ci: sparc64: fix 'cannot find libc' error</li>
<li><a
href="10af5a6696"><code>10af5a6</code></a>
ci: s390x: fix 'cannot find libc' error</li>
<li><a
href="c6ad4344f3"><code>c6ad434</code></a>
Merge pull request <a
href="https://redirect.github.com/rust-lang/libc/issues/4315">#4315</a>
from tgross35/backport-porcini</li>
<li><a
href="5726b3cde2"><code>5726b3c</code></a>
Cygwin: Add PTY and group API</li>
<li>Additional commits viewable in <a
href="https://github.com/rust-lang/libc/compare/0.2.169...0.2.171">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=libc&package-manager=cargo&previous-version=0.2.169&new-version=0.2.171)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-18 21:38:00 +00:00
Thomas Eizinger
883c38cd3c fix(connlib): remove explicit Session::disconnect (#8474)
Within the event-loop, we already react to the channel being closed
which happens when the `Sender` within the `Session` gets dropped. As
such, there is no need to send an explicit `Stop` command, dropping the
`Session` is equivalent.

As it turns out, `swift-bridge` already calls `Drop` for us when the
last pointer is set to `nil`:
280a9dd999/swift/apple/FirezoneNetworkExtension/Connlib/Generated/connlib-client-apple/connlib-client-apple.swift (L24-L28)

Thus, we can also remove the explicit `disconnect` call to
`WrappedSession` entirely.
2025-03-18 04:35:57 +00:00
Thomas Eizinger
e54a7c2d64 feat(connlib): regularly evaluate feature flags (#8467)
In order to be able to dynamically configure long-running applications
such as the Gateway via feature-flags, we need to regularly re-evaluate
them by sending another POST request to the `/decide` endpoint.

To do this without impacting anything else, we create a separate runtime
that is lazily initialised on first access and use that to run the async
code for connecting to the PostHog service. In addition to that, we also
spawn a task that re-evaluates the feature flags for the currently set
user in the Sentry context every 5 minutes.

Resolves: #8454

---------

Signed-off-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-03-17 23:50:54 +00:00
Jamil
e642eefb35 chore: Cut all clients to ship search domains (#8442)
Waiting on app reviews to be approved, then this PR will be ready to
merge.
2025-03-17 17:25:11 +00:00
Thomas Eizinger
0a00244913 chore(gui-client): improve error message when serde fails (#8461)
Resolves: #8441
2025-03-17 13:10:10 +00:00
Thomas Eizinger
7af4b91ac5 fix(gui-client): call wintun::Session::shutdown on drop (#8464)
The bugfix we attempted in #8156 turned out wrong. Reading the
source-code, we have to call `Session::shutdown` in order to actually
cancel the `Session::receive_blocking` call. Not doing so means we run
into the timeout when discarding the `Tun` device because the
recv-thread is stuck in `Session::receive_blocking`.

Fixes: #8395
2025-03-17 12:58:03 +00:00
Thomas Eizinger
37946eeace chore(rust): fix warnings of cargo deny (#8460) 2025-03-17 12:55:22 +00:00
Thomas Eizinger
152939c7dd build(rust): bump Tauri dependencies (#8459)
Dependabot appears to have a hard time to bump the Tauri dependencies in
a group together. Additionally, our dependency linter `cargo deny`
disallows duplicate dependencies by default. To avoid introducing more
duplicate dependencies, we depend on the upstream `main` branch of two
projects that have already updated their dependencies but did not yet
cut a release.
2025-03-17 12:19:20 +00:00
Thomas Eizinger
dc8fd652fe fix(gui-client): don't bother user with error details (#8468)
There is no reason to show the chain of errors to the user, we are
logging it on ERROR level and will thus be notified via Sentry.
2025-03-17 11:31:42 +00:00
Thomas Eizinger
b749da4766 chore(gui-client): improve context when resolvectl fails (#8462)
Took me a while to figure out what the "File not found" error was
pointing to. Adding some context should help.
2025-03-17 11:30:51 +00:00
Thomas Eizinger
99624a4302 fix(connlib): always update TunConfig on any changes (#8453)
Currently, we are only emitting updates to the `TunConfig` when the
routes or the DNS servers change. This isn't correct, we should also
emit updates for it when the IPs or the search-domain changes.

In order to achieve that, we create a new `TunConfig` based on the
existing one every time we receive an `InterfaceConfig` update.
Depending on our current state, we may create an entirely new
`TunConfig` or create a new one where we copy the fields in from the new
`InterfaceConfig`. We then unconditionally call
`maybe_update_tun_config` which does the necessary work to only emit
updates when things actually changed.

To ensure this works in all cases and the latest update is always
reflected on the TUN device, we also extend the proptests to assert the
latest search domain.

Fixes: #8451
2025-03-16 14:59:32 +00:00
Thomas Eizinger
d5fda62036 chore(rust): sort workspace.dependencies table (#8455)
Unfortunately, `cargo sort` doesn't yet handle this.

Related: https://github.com/DevinR528/cargo-sort/pull/55
2025-03-16 14:57:43 +00:00