From ce02b2214414d43e7e6683a1baeaf900d892791e Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Thu, 23 May 2024 09:37:41 +0200 Subject: [PATCH 1/2] use as Quad9's and Cloudflare's servers as default DNS servers --- src/executor/device.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/executor/device.rs b/src/executor/device.rs index 42390014c9..8dc065af26 100644 --- a/src/executor/device.rs +++ b/src/executor/device.rs @@ -161,10 +161,11 @@ impl<'a> NetworkInterface<'a> { #[cfg(feature = "dns")] let dns_handle = { - // use Google's DNS servers let servers = &[ - Ipv4Address::new(8, 8, 4, 4).into(), - Ipv4Address::new(8, 8, 8, 8).into(), + // Quad9 DNS server + Ipv4Address::new(9, 9, 9, 9).into(), + // Cloudflare DNS server + Ipv4Address::new(1, 1, 1, 1).into(), ]; let dns_socket = dns::Socket::new(servers, vec![]); sockets.add(dns_socket) From 985070c838ebf7e058dc48f8996da53f5d8705ab Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Thu, 23 May 2024 09:44:01 +0200 Subject: [PATCH 2/2] add option to define the DNS servers at compile time --- src/executor/device.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/executor/device.rs b/src/executor/device.rs index 8dc065af26..7879f1bd26 100644 --- a/src/executor/device.rs +++ b/src/executor/device.rs @@ -101,6 +101,12 @@ impl<'a> NetworkInterface<'a> { let myip = Ipv4Address::from_str(hermit_var_or!("HERMIT_IP", "10.0.5.3")).unwrap(); let mygw = Ipv4Address::from_str(hermit_var_or!("HERMIT_GATEWAY", "10.0.5.1")).unwrap(); let mymask = Ipv4Address::from_str(hermit_var_or!("HERMIT_MASK", "255.255.255.0")).unwrap(); + // Quad9 DNS server + #[cfg(feature = "dns")] + let mydns1 = Ipv4Address::from_str(hermit_var_or!("HERMIT_DNS1", "9.9.9.9")).unwrap(); + // Cloudflare DNS server + #[cfg(feature = "dns")] + let mydns2 = Ipv4Address::from_str(hermit_var_or!("HERMIT_DNS2", "1.1.1.1")).unwrap(); // calculate the netmask length // => count the number of contiguous 1 bits, @@ -161,12 +167,7 @@ impl<'a> NetworkInterface<'a> { #[cfg(feature = "dns")] let dns_handle = { - let servers = &[ - // Quad9 DNS server - Ipv4Address::new(9, 9, 9, 9).into(), - // Cloudflare DNS server - Ipv4Address::new(1, 1, 1, 1).into(), - ]; + let servers = &[mydns1.into(), mydns2.into()]; let dns_socket = dns::Socket::new(servers, vec![]); sockets.add(dns_socket) };