Compare commits
1 Commits
35a459f63c
...
6f88fd00c1
Author | SHA1 | Date | |
---|---|---|---|
6f88fd00c1 |
@ -161,11 +161,7 @@ impl DhcpServer for HAClusterTopology {
|
||||
self.dhcp_server.set_pxe_options(options).await
|
||||
}
|
||||
|
||||
async fn set_dhcp_range(
|
||||
&self,
|
||||
start: &IpAddress,
|
||||
end: &IpAddress,
|
||||
) -> Result<(), ExecutorError> {
|
||||
async fn set_dhcp_range(&self, start: &IpAddress, end: &IpAddress) -> Result<(), ExecutorError> {
|
||||
self.dhcp_server.set_dhcp_range(start, end).await
|
||||
}
|
||||
|
||||
@ -306,11 +302,7 @@ impl DhcpServer for DummyInfra {
|
||||
async fn set_pxe_options(&self, _options: PxeOptions) -> Result<(), ExecutorError> {
|
||||
unimplemented!("{}", UNIMPLEMENTED_DUMMY_INFRA)
|
||||
}
|
||||
async fn set_dhcp_range(
|
||||
&self,
|
||||
start: &IpAddress,
|
||||
end: &IpAddress,
|
||||
) -> Result<(), ExecutorError> {
|
||||
async fn set_dhcp_range(&self, start: &IpAddress, end: &IpAddress) -> Result<(), ExecutorError> {
|
||||
unimplemented!("{}", UNIMPLEMENTED_DUMMY_INFRA)
|
||||
}
|
||||
fn get_ip(&self) -> IpAddress {
|
||||
|
@ -59,8 +59,7 @@ pub trait DhcpServer: Send + Sync + std::fmt::Debug {
|
||||
async fn remove_static_mapping(&self, mac: &MacAddress) -> Result<(), ExecutorError>;
|
||||
async fn list_static_mappings(&self) -> Vec<(MacAddress, IpAddress)>;
|
||||
async fn set_pxe_options(&self, pxe_options: PxeOptions) -> Result<(), ExecutorError>;
|
||||
async fn set_dhcp_range(&self, start: &IpAddress, end: &IpAddress)
|
||||
-> Result<(), ExecutorError>;
|
||||
async fn set_dhcp_range(&self, start: &IpAddress, end: &IpAddress) -> Result<(), ExecutorError>;
|
||||
fn get_ip(&self) -> IpAddress;
|
||||
fn get_host(&self) -> LogicalHost;
|
||||
async fn commit_config(&self) -> Result<(), ExecutorError>;
|
||||
|
@ -108,9 +108,7 @@ impl<T: Topology + DhcpServer> Interpret<T> for DhcpInterpret {
|
||||
info!("Executing DhcpInterpret on inventory {inventory:?}");
|
||||
|
||||
self.set_pxe_options(inventory, topology).await?;
|
||||
topology
|
||||
.set_dhcp_range(&self.score.dhcp_range.0, &self.score.dhcp_range.1)
|
||||
.await?;
|
||||
topology.set_dhcp_range(&self.score.dhcp_range.0, &self.score.dhcp_range.1).await?;
|
||||
|
||||
DhcpHostBindingScore {
|
||||
host_binding: self.score.host_binding.clone(),
|
||||
|
@ -46,6 +46,7 @@ impl<T: Topology> Interpret<T> for DiscoverInventoryAgentInterpret {
|
||||
_inventory: &Inventory,
|
||||
_topology: &T,
|
||||
) -> Result<Outcome, InterpretError> {
|
||||
|
||||
match self.score.discovery_timeout {
|
||||
Some(timeout) => info!("Discovery agent will wait for {timeout} seconds"),
|
||||
None => info!(
|
||||
|
@ -59,7 +59,7 @@ use crate::{
|
||||
data::Version,
|
||||
hardware::PhysicalHost,
|
||||
infra::inventory::InventoryRepositoryFactory,
|
||||
instrumentation::{HarmonyEvent, instrument},
|
||||
instrumentation::{instrument, HarmonyEvent},
|
||||
interpret::{Interpret, InterpretError, InterpretName, InterpretStatus, Outcome},
|
||||
inventory::{HostRole, Inventory},
|
||||
modules::{
|
||||
|
@ -1,7 +1,7 @@
|
||||
// dnsmasq.rs
|
||||
use crate::modules::dhcp::DhcpError;
|
||||
use log::{debug, info, warn};
|
||||
use opnsense_config_xml::dnsmasq::{DhcpRange, DnsMasq, DnsmasqHost}; // Assuming DhcpRange is defined in opnsense_config_xml::dnsmasq
|
||||
use opnsense_config_xml::dnsmasq::{DnsMasq, DnsmasqHost, DhcpRange}; // Assuming DhcpRange is defined in opnsense_config_xml::dnsmasq
|
||||
use opnsense_config_xml::{MaybeString, StaticMap};
|
||||
use std::collections::HashSet;
|
||||
use std::net::Ipv4Addr;
|
||||
@ -230,10 +230,7 @@ impl<'a> DhcpConfigDnsMasq<'a> {
|
||||
|
||||
// Assuming DnsMasq has dhcp_ranges: Vec<DhcpRange>
|
||||
// Find existing range for "lan" interface
|
||||
if let Some(range) = ranges
|
||||
.iter_mut()
|
||||
.find(|r| r.interface == Some("lan".to_string()))
|
||||
{
|
||||
if let Some(range) = ranges.iter_mut().find(|r| r.interface == Some("lan".to_string())) {
|
||||
// Update existing range
|
||||
range.start_addr = Some(start.to_string());
|
||||
range.end_addr = Some(end.to_string());
|
||||
|
Loading…
Reference in New Issue
Block a user