wip: Actual implementation of opnsense dhcp
This commit is contained in:
parent
b0fc55e1fb
commit
465106438a
@ -1,10 +1,10 @@
|
||||
mod management;
|
||||
pub use management::*;
|
||||
|
||||
use crate::topology::{
|
||||
use crate::{executors::ExecutorError, topology::{
|
||||
Backend, DHCPStaticEntry, DhcpServer, DnsServer, Firewall, FirewallError, FirewallRule,
|
||||
Frontend, IpAddress, LoadBalancer, LoadBalancerError, LogicalHost,
|
||||
};
|
||||
}};
|
||||
use derive_new::new;
|
||||
|
||||
#[derive(new, Clone)]
|
||||
@ -16,6 +16,10 @@ impl OPNSenseFirewall {
|
||||
pub fn get_ip(&self) -> IpAddress {
|
||||
self.host.ip
|
||||
}
|
||||
|
||||
fn save_xml_to_config(&self, xml_entry: &str) -> Result<(), ExecutorError> {
|
||||
todo!("Save XML Entry in opnsense /conf/config.xml {xml_entry}");
|
||||
}
|
||||
}
|
||||
|
||||
impl Firewall for OPNSenseFirewall {
|
||||
@ -77,6 +81,20 @@ impl DhcpServer for OPNSenseFirewall {
|
||||
&self,
|
||||
entry: &DHCPStaticEntry,
|
||||
) -> Result<(), crate::topology::DhcpError> {
|
||||
let mac = &entry.mac;
|
||||
let name = &entry.name;
|
||||
let ip = &entry.ip;
|
||||
|
||||
let xml_entry = format!("<staticmap>
|
||||
> <mac>{mac}</mac>
|
||||
> <ipaddr>{ip}</ipaddr>
|
||||
> <hostname>{name}</hostname>
|
||||
> <descr>{name}</descr>
|
||||
> <winsserver/>
|
||||
> <dnsserver/>
|
||||
> <ntpserver/>
|
||||
> </staticmap>");
|
||||
self.save_xml_to_config(&xml_entry)?;
|
||||
todo!("Register {:?}", entry)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user