public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Gabriel Goller <g.goller@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup] pbs-config: network: expand valid subnet mask
Date: Mon, 14 Apr 2025 11:47:39 +0200	[thread overview]
Message-ID: <20250414094739.267127-1-g.goller@proxmox.com> (raw)

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

                 reply	other threads:[~2025-04-14  9:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250414094739.267127-1-g.goller@proxmox.com \
    --to=g.goller@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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