From c4f4a58dcf27746cc43c578a16246dfb70a0086f Mon Sep 17 00:00:00 2001 From: tahahawa Date: Sat, 12 Jul 2025 01:05:21 -0400 Subject: [PATCH] Add new fields for OPNSense 25.1 --- examples/opnsense/src/main.rs | 4 +++- opnsense-config-xml/src/data/interfaces.rs | 1 + opnsense-config-xml/src/data/opnsense.rs | 9 ++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/examples/opnsense/src/main.rs b/examples/opnsense/src/main.rs index c07c60e..dc329b3 100644 --- a/examples/opnsense/src/main.rs +++ b/examples/opnsense/src/main.rs @@ -22,8 +22,10 @@ use harmony_macros::{ip, mac_address}; #[tokio::main] async fn main() { + env_logger::init(); + let firewall = harmony::topology::LogicalHost { - ip: ip!("192.168.5.229"), + ip: ip!("192.168.122.106"), name: String::from("opnsense-1"), }; diff --git a/opnsense-config-xml/src/data/interfaces.rs b/opnsense-config-xml/src/data/interfaces.rs index e0a84d3..fb10e89 100644 --- a/opnsense-config-xml/src/data/interfaces.rs +++ b/opnsense-config-xml/src/data/interfaces.rs @@ -83,6 +83,7 @@ pub struct Interface { pub adv_dhcp_config_advanced: Option, pub adv_dhcp_config_file_override: Option, pub adv_dhcp_config_file_override_path: Option, + pub mtu: Option, } #[cfg(test)] diff --git a/opnsense-config-xml/src/data/opnsense.rs b/opnsense-config-xml/src/data/opnsense.rs index be3e9af..3da70f5 100644 --- a/opnsense-config-xml/src/data/opnsense.rs +++ b/opnsense-config-xml/src/data/opnsense.rs @@ -1,6 +1,6 @@ use crate::HAProxy; use crate::{data::dhcpd::DhcpInterface, xml_utils::to_xml_str}; -use log::error; +use log::{debug, error}; use uuid::Uuid; use yaserde::{MaybeString, NamedList, RawXml}; use yaserde_derive::{YaDeserialize, YaSerialize}; @@ -17,12 +17,12 @@ pub struct OPNsense { pub dhcpd: NamedList, pub snmpd: Snmpd, pub syslog: Syslog, - pub nat: Nat, + pub nat: Option, pub filter: Filters, pub load_balancer: Option, pub rrd: Option, pub ntpd: Ntpd, - pub widgets: Widgets, + pub widgets: Option, pub revision: Revision, #[yaserde(rename = "OPNsense")] pub opnsense: OPNsenseXmlSection, @@ -46,10 +46,12 @@ pub struct OPNsense { pub pischem: Option, pub ifgroups: Ifgroups, pub dnsmasq: Option, + pub wizardtemp: Option, } impl From for OPNsense { fn from(content: String) -> Self { + debug!("XML content: {content}"); yaserde::de::from_str(&content) .map_err(|e| println!("{}", e.to_string())) .expect("OPNSense received invalid string, should be full XML") @@ -242,6 +244,7 @@ pub struct Ssh { pub passwordauth: u8, pub keysig: MaybeString, pub permitrootlogin: u8, + pub rekeylimit: MaybeString, } #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)]