public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox] proxmox/tools/common_regex: improve IPRE_BRACKET
Date: Tue, 29 Sep 2020 16:05:18 +0200	[thread overview]
Message-ID: <20200929140518.24000-1-d.csapak@proxmox.com> (raw)

by disallowing [] around ipv4 adresses (which is not very common)

we did not use this anywhere, so there should not be any compatibility
problem

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 proxmox/src/tools/common_regex.rs | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/proxmox/src/tools/common_regex.rs b/proxmox/src/tools/common_regex.rs
index 6b1d037..8fe3067 100644
--- a/proxmox/src/tools/common_regex.rs
+++ b/proxmox/src/tools/common_regex.rs
@@ -41,14 +41,14 @@ macro_rules! IPV6RE { () => (concat!(r"(?:",
 macro_rules! IPRE { () => (concat!(r"(?:", IPV4RE!(), "|", IPV6RE!(), ")")) }
 
 /// Regular expression string to match IP addresses where IPv6 addresses require brackets around
-/// them, while for IPv4 they are optional.
+/// them, while for IPv4 they are forbidden.
 #[rustfmt::skip]
 #[macro_export]
 macro_rules! IPRE_BRACKET { () => (
     concat!(r"(?:",
         IPV4RE!(),
         r"|\[(?:",
-            IPV4RE!(), "|", IPV6RE!(),
+            IPV6RE!(),
         r")\]",
     r")"))
 }
@@ -71,7 +71,6 @@ fn test_regexes() {
     assert!(IP_REGEX.is_match("2014:b3a:0102:adf1:1234:4321:4afA:BCDF"));
 
     assert!(IP_BRACKET_REGEX.is_match("127.0.0.1"));
-    assert!(IP_BRACKET_REGEX.is_match("[127.0.0.1]"));
     assert!(IP_BRACKET_REGEX.is_match("[::1]"));
     assert!(IP_BRACKET_REGEX.is_match("[2014:b3a::27]"));
     assert!(IP_BRACKET_REGEX.is_match("[2014:b3a::192.168.0.1]"));
-- 
2.20.1





                 reply	other threads:[~2020-09-29 14:05 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=20200929140518.24000-1-d.csapak@proxmox.com \
    --to=d.csapak@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