mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
fix(connlib): retain order of system/upstream DNS servers (#10773)
Right now, connlib hands out a `BiMap` of sentinel IPs <> upstream servers whenever it emits a `TunInterfaceUpdated` event. This `BiMap` internally uses two `HashMap`s. The iteration order of `HashMap`s is non-deterministic and therefore, we lose the order in which the upstream / system resolvers have been passed to us originally. To prevent that, we now emit a dedicated `DnsMapping` type that does not expose its internal data structure but only getters for retrieving the sentinel and upstream servers. Internally, it uses a `Vec` to store this mapping and thus retains the original order. This is asserted as part of our proptests by comparing the resulting `Vec`s. This fix is preceded by a few refactorings that encapsulate the code for creating and updating this DNS mapping. Resolves: #8439
This commit is contained in:
@@ -495,7 +495,7 @@ impl<'a> Handler<'a> {
|
||||
|
||||
self.tun_device.set_ips(config.ip.v4, config.ip.v6).await?;
|
||||
self.dns_controller
|
||||
.set_dns(config.dns_sentinel_ips(), config.search_domain)
|
||||
.set_dns(config.dns_by_sentinel.sentinel_ips(), config.search_domain)
|
||||
.await?;
|
||||
self.tun_device
|
||||
.set_routes(config.ipv4_routes, config.ipv6_routes)
|
||||
|
||||
Reference in New Issue
Block a user