Skip to content

Commit cc18154

Browse files
authored
fix: DNS resolution for network namespaces with symlinked resolv.conf (#81)
1 parent 574ca02 commit cc18154

File tree

7 files changed

+244
-325
lines changed

7 files changed

+244
-325
lines changed

src/jail/linux/dns.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ pub struct DummyDnsServer {
1717
thread_handle: Option<thread::JoinHandle<()>>,
1818
}
1919

20+
impl Default for DummyDnsServer {
21+
fn default() -> Self {
22+
Self::new()
23+
}
24+
}
25+
2026
impl DummyDnsServer {
2127
pub fn new() -> Self {
2228
Self {
@@ -141,6 +147,10 @@ fn build_dummy_response(query: Packet<'_>) -> Result<Vec<u8>> {
141147
.map_err(|e| anyhow::anyhow!("Failed to build DNS response: {}", e))
142148
}
143149

150+
// Note: The run_dns_server_blocking function has been removed as we no longer spawn
151+
// separate DNS server processes inside the namespace. Instead, we mount a custom
152+
// /etc/resolv.conf that points to the host DNS server, which is simpler and more robust.
153+
144154
#[cfg(test)]
145155
mod tests {
146156
use super::*;

0 commit comments

Comments
 (0)