mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-09-02 09:09:17 +00:00
fix: return error instead of silently ignoring invalid dhcp_cidr in launcher
This commit is contained in:
@@ -638,9 +638,10 @@ impl NetworkConfig {
|
|||||||
cfg.set_hostname(self.hostname.clone());
|
cfg.set_hostname(self.hostname.clone());
|
||||||
cfg.set_dhcp(self.dhcp.unwrap_or_default());
|
cfg.set_dhcp(self.dhcp.unwrap_or_default());
|
||||||
if let Some(ref dhcp_cidr) = self.dhcp_cidr {
|
if let Some(ref dhcp_cidr) = self.dhcp_cidr {
|
||||||
if let Ok(cidr) = dhcp_cidr.parse::<cidr::Ipv4Cidr>() {
|
let cidr = dhcp_cidr.parse::<cidr::Ipv4Cidr>().with_context(|| {
|
||||||
cfg.set_dhcp_cidr(Some(cidr));
|
format!("failed to parse dhcp_cidr: {}", dhcp_cidr)
|
||||||
}
|
})?;
|
||||||
|
cfg.set_dhcp_cidr(Some(cidr));
|
||||||
}
|
}
|
||||||
cfg.set_inst_name(self.network_name.clone().unwrap_or_default());
|
cfg.set_inst_name(self.network_name.clone().unwrap_or_default());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user