mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-08-06 04:29:52 +00:00
fix: return error instead of silently ignoring invalid dhcp_cidr in launcher
This commit is contained in:
committed by
GitHub
parent
8181830902
commit
0c11cefc04
@@ -638,9 +638,10 @@ impl NetworkConfig {
|
||||
cfg.set_hostname(self.hostname.clone());
|
||||
cfg.set_dhcp(self.dhcp.unwrap_or_default());
|
||||
if let Some(ref dhcp_cidr) = self.dhcp_cidr {
|
||||
if let Ok(cidr) = dhcp_cidr.parse::<cidr::Ipv4Cidr>() {
|
||||
cfg.set_dhcp_cidr(Some(cidr));
|
||||
}
|
||||
let cidr = dhcp_cidr.parse::<cidr::Ipv4Cidr>().with_context(|| {
|
||||
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());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user