[pbs-devel] [PATCH proxmox-backup] pbs-config: network: expand valid subnet mask
Gabriel Goller
g.goller at proxmox.com
Mon Apr 14 11:47:39 CEST 2025
Allow a subnet of /0 (0.0.0.0 netmask), which is valid, it's a global
ip-address. This could happen if the user e.g. forgets the enter the
subnet mask in the installer, which leads to a /0 subnet. Nothing is
inherently wrong with it, but the ui will spit out errors.
Fixes: f34d4401f777 ("src/config/network.rs: read/write /etc/network/interfaces")
Signed-off-by: Gabriel Goller <g.goller at proxmox.com>
---
Note: If we want to avoid a /0 subnet, we should add a check in the
installer — changing the default to /24 would also be nice.
pbs-config/src/network/helper.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pbs-config/src/network/helper.rs b/pbs-config/src/network/helper.rs
index 87a0e24f9d90..b4e1e6bf5392 100644
--- a/pbs-config/src/network/helper.rs
+++ b/pbs-config/src/network/helper.rs
@@ -68,9 +68,9 @@ pub fn parse_cidr(cidr: &str) -> Result<(String, u8, bool), Error> {
pub fn check_netmask(mask: u8, is_v6: bool) -> Result<(), Error> {
let (ver, min, max) = if is_v6 {
- ("IPv6", 1, 128)
+ ("IPv6", 0, 128)
} else {
- ("IPv4", 1, 32)
+ ("IPv4", 0, 32)
};
if !(mask >= min && mask <= max) {
--
2.39.5
More information about the pbs-devel
mailing list