feat: add DHCP subnet (CIDR) configuration parameter

Allow -d to optionally accept a CIDR subnet (e.g. -d 10.0.0.0/24)
to fix the DHCP address range. When specified, the DHCP allocator
uses the configured subnet instead of deriving it from peer IPs.

Changes:
- Add dhcp_cidr field to config struct and ConfigLoader trait
- Modify -d CLI arg to accept optional CIDR string value
- Update DHCP logic to use configured CIDR as default subnet
- Add dhcp_cidr to NetworkConfig proto message
- Update launcher to handle dhcp_cidr in gen_config/new_from_config
- Update i18n translations
This commit is contained in:
copilot-swe-agent[bot]
2026-06-08 15:31:53 +00:00
committed by GitHub
parent 0a8c95879b
commit 8181830902
6 changed files with 49 additions and 7 deletions
+6
View File
@@ -637,6 +637,11 @@ 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));
}
}
cfg.set_inst_name(self.network_name.clone().unwrap_or_default());
// The web UI does not expose credential inputs directly, but imported/saved
@@ -1019,6 +1024,7 @@ impl NetworkConfig {
}
result.dhcp = Some(config.get_dhcp());
result.dhcp_cidr = config.get_dhcp_cidr().map(|c| c.to_string());
let network_identity = config.get_network_identity();
result.network_name = Some(network_identity.network_name.clone());