public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] pbs-config: network: expand valid subnet mask
@ 2025-04-14  9:47 Gabriel Goller
  0 siblings, 0 replies; only message in thread
From: Gabriel Goller @ 2025-04-14  9:47 UTC (permalink / raw)
  To: pbs-devel

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@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



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-04-14  9:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-14  9:47 [pbs-devel] [PATCH proxmox-backup] pbs-config: network: expand valid subnet mask Gabriel Goller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal