File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ set -Eeuo pipefail
1111
1212OPT_MULTIPORT=false
1313OPT_SYNC_BRIDGE=false
14+ OPT_ALLOW_ULA=false
1415
1516BLUEFIELD_IDENTIFIERS=(" MT_0000000543" " MT_0000000541" )
1617MAX_NUMVFS_POSSIBLE=126
@@ -307,13 +308,17 @@ function get_ipv6() {
307308 # 1. Have a "global" scope.
308309 # 2. Have a prefix length of 64 or more.
309310 # 3. Must be in Globally Unique Address (GUA) range (2 or 3).
311+ # (unless --allow-ula is set, then also fc and fd range is allowed)
312+ local addr_regex
313+ addr_regex=' ^(2|3)'
314+ [[ " $OPT_ALLOW_ULA " == " true" ]] && addr_regex=' ^(2|3|f[cd])'
310315 local global_address
311- global_address=$( echo " $ip_json " | jq -r '
316+ global_address=$( echo " $ip_json " | jq -r --arg addr_re " $addr_regex " '
312317 .[0].addr_info[]
313318 | select(
314319 .scope == "global" and
315320 .prefixlen >= 64 and
316- (.local | test("^(2|3)" ))
321+ (.local | test($addr_re ))
317322 )
318323 | .local' | head -n 1)
319324
@@ -403,6 +408,9 @@ while [[ $# -gt 0 ]]; do
403408 --sync-bridge)
404409 OPT_SYNC_BRIDGE=true
405410 ;;
411+ --allow-ula)
412+ OPT_ALLOW_ULA=true
413+ ;;
406414 * )
407415 err " Invalid argument $1 "
408416 esac
You can’t perform that action at this time.
0 commit comments