diff --git a/build.rs b/build.rs index 4dd01e5c..bcc9c64a 100644 --- a/build.rs +++ b/build.rs @@ -75,6 +75,7 @@ fn main() { "none" => "none", inv => panic!("Invalid default firewall driver {}", inv), }; + println!("cargo:rustc-check-cfg=cfg(default_fw, values(\"nftables\", \"iptables\", \"none\"))"); println!("cargo:rustc-cfg=default_fw=\"{}\"", fwdriver); println!("cargo:rustc-env=DEFAULT_FW={fwdriver}"); } diff --git a/src/dhcp_proxy/cache.rs b/src/dhcp_proxy/cache.rs index da895769..0ad98307 100644 --- a/src/dhcp_proxy/cache.rs +++ b/src/dhcp_proxy/cache.rs @@ -43,7 +43,7 @@ impl LeaseCache { /// # Arguments /// /// * `writer`: any type that can has the Write and Clear trait implemented. In production this - /// is a file. In development/testing this is a Cursor of bytes + /// is a file. In development/testing this is a Cursor of bytes /// /// returns: Result, Error> /// diff --git a/src/dhcp_proxy/lib.rs b/src/dhcp_proxy/lib.rs index 848b76b0..cb35bc02 100644 --- a/src/dhcp_proxy/lib.rs +++ b/src/dhcp_proxy/lib.rs @@ -40,10 +40,7 @@ pub mod g_rpc { impl From for Lease { fn from(l: DhcpV4Lease) -> Lease { // Since these fields are optional as per mozim. Match them first and then set them - let domain_name = match l.domain_name { - None => String::from(""), - Some(l) => l, - }; + let domain_name = l.domain_name.unwrap_or_default(); let mtu = l.mtu.unwrap_or(0) as u32; Lease {