]> git.proxmox.com Git - proxmox-backup.git/commitdiff
require square brackets for ipv6 addresses
authorDominik Csapak <d.csapak@proxmox.com>
Tue, 29 Sep 2020 14:05:52 +0000 (16:05 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 30 Sep 2020 04:16:27 +0000 (06:16 +0200)
we need this, because we append the port to this to get a target url
e.g. we print

format!("https://{}:8007/", address)

if address is now an ipv6 (e.g. fe80::1) it would become

https://fe80::1:8007/ which is a valid ipv6 on its own

by using square brackets we get:

https://[fe80::1]:8007/ which now connects to the correct ip/port

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
docs/administration-guide.rst
src/api2/types/mod.rs

index 1b1155a57a13143956b86e55a6a6df503f5677d9..c270bdb145a502eaf466d4aa9b5180e8107e3575 100644 (file)
@@ -737,6 +737,9 @@ on the backup server.
 The default value for ``username`` ist ``root@pam``.  If no server is specified,
 the default is the local host (``localhost``).
 
+Note that if the server is an IPv6 address, you have to write it with
+square brackets (e.g. [fe80::01]).
+
 You can pass the repository with the ``--repository`` command
 line option, or by setting the ``PBS_REPOSITORY`` environment
 variable.
index aba307e248a7c9efb3c0cf2eb01e7c566ba6df3e..6ad67607b57cafdab0519b9552a3d52fa1002112 100644 (file)
@@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
 
 use proxmox::api::{api, schema::*};
 use proxmox::const_regex;
-use proxmox::{IPRE, IPV4RE, IPV6RE, IPV4OCTET, IPV6H16, IPV6LS32};
+use proxmox::{IPRE, IPRE_BRACKET, IPV4RE, IPV6RE, IPV4OCTET, IPV6H16, IPV6LS32};
 
 use crate::backup::CryptMode;
 use crate::server::UPID;
@@ -65,7 +65,7 @@ const_regex!{
 
     pub DNS_NAME_OR_IP_REGEX = concat!(r"^", DNS_NAME!(), "|",  IPRE!(), r"$");
 
-    pub BACKUP_REPO_URL_REGEX = concat!(r"^^(?:(?:(", USER_ID_REGEX_STR!(), ")@)?(", DNS_NAME!(), "|",  IPRE!() ,"):)?(", PROXMOX_SAFE_ID_REGEX_STR!(), r")$");
+    pub BACKUP_REPO_URL_REGEX = concat!(r"^^(?:(?:(", USER_ID_REGEX_STR!(), ")@)?(", DNS_NAME!(), "|",  IPRE_BRACKET!() ,"):)?(", PROXMOX_SAFE_ID_REGEX_STR!(), r")$");
 
     pub CERT_FINGERPRINT_SHA256_REGEX = r"^(?:[0-9a-fA-F][0-9a-fA-F])(?::[0-9a-fA-F][0-9a-fA-F]){31}$";