summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--talpid-core/src/dns/linux/systemd_resolved.rs6
-rw-r--r--talpid-core/src/linux/mod.rs2
-rw-r--r--talpid-core/src/linux/network_manager.rs51
3 files changed, 3 insertions, 56 deletions
diff --git a/talpid-core/src/dns/linux/systemd_resolved.rs b/talpid-core/src/dns/linux/systemd_resolved.rs
index 3345b38a5f..5ebdb34eb9 100644
--- a/talpid-core/src/dns/linux/systemd_resolved.rs
+++ b/talpid-core/src/dns/linux/systemd_resolved.rs
@@ -83,11 +83,7 @@ impl SystemdResolved {
};
systemd_resolved.ensure_resolved_exists()?;
- if !crate::linux::network_manager::is_nm_managing_via_resolved(
- &systemd_resolved.dbus_connection,
- ) {
- Self::ensure_resolv_conf_is_resolved_symlink()?;
- }
+ Self::ensure_resolv_conf_is_resolved_symlink()?;
Ok(systemd_resolved)
}
diff --git a/talpid-core/src/linux/mod.rs b/talpid-core/src/linux/mod.rs
index 8bc3836ca2..d54656309e 100644
--- a/talpid-core/src/linux/mod.rs
+++ b/talpid-core/src/linux/mod.rs
@@ -3,8 +3,8 @@ use std::{
io,
};
-pub mod network_manager;
pub mod dbus;
+pub mod network_manager;
/// Converts an interface name into the corresponding index.
pub fn iface_index(name: &str) -> Result<libc::c_uint, IfaceIndexLookupError> {
diff --git a/talpid-core/src/linux/network_manager.rs b/talpid-core/src/linux/network_manager.rs
index 8ce4f3db71..6cc811dacb 100644
--- a/talpid-core/src/linux/network_manager.rs
+++ b/talpid-core/src/linux/network_manager.rs
@@ -107,7 +107,7 @@ pub struct NetworkManager {
impl NetworkManager {
pub fn new() -> Result<Self> {
Ok(Self {
- connection: crate::linux::dbus::get_connection()?,
+ connection: crate::linux::dbus::get_connection()?,
})
}
@@ -797,52 +797,3 @@ fn eq_file_content<P: AsRef<Path>>(a: &P, b: &P) -> bool {
_ => false,
})
}
-
-/// Given a DBus connection, verify that NM is up and running and capable of managing DNS via
-/// systemd-resolved. This includes verifying that NM is managing DNS via systemd-resolved and is
-/// controlling /etc/resolv.conf
-pub fn is_nm_managing_via_resolved(connection: &SyncConnection) -> bool {
- let check_nm = || -> std::result::Result<bool, dbus::Error> {
- let dns_manager = Proxy::new(NM_BUS, NM_DNS_MANAGER_PATH, RPC_TIMEOUT, connection);
- let dns_mode: String = dns_manager.get(NM_DNS_MANAGER, DNS_MODE_KEY)?;
- if &dns_mode != "systemd-resolved" {
- return Ok(false);
- }
-
-
- let rc_management_mode: String = dns_manager.get(NM_DNS_MANAGER, RC_MANAGEMENT_MODE_KEY)?;
-
- match rc_management_mode.as_str() {
- // /etc/resolv.conf is managed via executing a command, can't verify that works, have
- // to assume it does
- "resolvconf" | "netconfig" => Ok(true),
-
- "symlink" | "none" | "file" => {
- Proxy::new(NM_BUS, NM_MANAGER_PATH, RPC_TIMEOUT, connection).method_call(
- NM_MANAGER,
- "Reload",
- (0x02u32,),
- )?;
- let result = verify_etc_resolv_conf_contents();
- Ok(result)
- }
-
- // NM doesn't manage DNS at all
- "unmanaged" => Ok(false),
- unknown_rc_mode => {
- log::error!("Unknown resolvconf management mode - {}", unknown_rc_mode);
- Ok(false)
- }
- }
- };
- match check_nm() {
- Ok(result) => result,
- Err(err) => {
- log::error!(
- "Failed to check if NM is managing DNS via systemd-resolved: {}",
- err
- );
- false
- }
- }
-}