From 126b918c9314f12a2e0be33b79f8e6913cf595b2 Mon Sep 17 00:00:00 2001 From: Marco Hofstetter Date: Mon, 4 Dec 2023 08:42:18 +0100 Subject: [PATCH] clustermesh: fix pattern to match IPv4 address Executing `cilium clustermesh vm install install-external-workload.sh` fails if the randomly generated IP (v4) contains a zero (`0`) in its first byte. Error: `Malformed CLUSTER_ADDR: 104.198.85.126:2379` Therefore, this commit changes the pattern that is used to detect an IPv4 address (with port). Signed-off-by: Marco Hofstetter --- clustermesh/clustermesh.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clustermesh/clustermesh.go b/clustermesh/clustermesh.go index e32c70b43c..f4a9a7551a 100644 --- a/clustermesh/clustermesh.go +++ b/clustermesh/clustermesh.go @@ -1655,7 +1655,7 @@ if [ -z "$CLUSTER_ADDR" ] ; then fi port='@(6553[0-5]|655[0-2][0-9]|65[0-4][0-9][0-9]|6[0-4][0-9][0-9][0-9]|[1-5][0-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9]|[1-9])' -byte='@(25[0-5]|2[0-4][0-9]|[1][0-9][0-9]|[1-9][0-9]|[0-9])' +byte='@(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])' ipv4="$byte\.$byte\.$byte\.$byte" # Default port is for a HostPort service @@ -1665,7 +1665,7 @@ case "$CLUSTER_ADDR" in CLUSTER_IP=${CLUSTER_ADDR#\[} CLUSTER_IP=${CLUSTER_IP%%\]:*} ;; - [^[]$ipv4:$port) + $ipv4:$port) CLUSTER_PORT=${CLUSTER_ADDR##*:} CLUSTER_IP=${CLUSTER_ADDR%%:*} ;;