Can configure network NAT settings from UI

This commit is contained in:
2024-01-09 21:57:18 +01:00
parent 71e22bc328
commit f82925dbcb
11 changed files with 446 additions and 11 deletions

@ -1,3 +1,4 @@
use crate::constants;
use crate::utils::net_utils;
use std::net::{Ipv4Addr, Ipv6Addr};
@ -64,6 +65,12 @@ impl<IPv> Nat<IPv> {
return Err(NatDefError::InvalidNatDef("Invalid guest port!").into());
}
if let Some(comment) = &self.comment {
if comment.len() > constants::NET_NAT_COMMENT_MAX_SIZE {
return Err(NatDefError::InvalidNatDef("Comment is too large!").into());
}
}
Ok(())
}
}