Skip to content

Commit

Permalink
clustermesh: fix pattern to match IPv4 address
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
mhofstetter authored and michi-covalent committed Dec 4, 2023
1 parent d7df46b commit 47510d4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions clustermesh/clustermesh.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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%%:*}
;;
Expand Down

0 comments on commit 47510d4

Please sign in to comment.