Skip to content

Commit 2c32eb7

Browse files
committed
Prevent Address in use error
Try #2 - use changeable IP address from loopback range (127.1.2.3), bind socat to that address only, test port availability before it is returned as available.
1 parent 6347ce4 commit 2c32eb7

23 files changed

+36
-30
lines changed

src/luks/tests/assume-yes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ TMP="$(mktemp -d)"
3636
port=$(tang_new_random_port)
3737
tang_run "${TMP}" "${port}"
3838

39-
url="http://localhost:${port}"
39+
url="http://${TANGD_IP}:${port}"
4040
cfg=$(printf '{"url":"%s"}' "$url")
4141

4242
test_tang() {

src/luks/tests/assume-yes-luks2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ TMP="$(mktemp -d)"
3636
port=$(tang_new_random_port)
3737
tang_run "${TMP}" "${port}"
3838

39-
url="http://localhost:${port}"
39+
url="http://${TANGD_IP}:${port}"
4040
cfg=$(printf '{"url":"%s"}' "$url")
4141

4242
# LUKS2.

src/luks/tests/bind-binary-keyfile-luks1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ TMP="$(mktemp -d)"
3636
port=$(tang_new_random_port)
3737
tang_run "${TMP}" "${port}"
3838

39-
url="http://localhost:${port}"
39+
url="http://${TANGD_IP}:${port}"
4040
ADV="${TMP}/adv.jws"
4141
tang_get_adv "${port}" "${ADV}"
4242
CFG="$(printf '{"url":"%s","adv":"%s"}' "${url}" "$ADV")"

src/luks/tests/bind-luks1-avoid-luksmeta-corruption

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ new_device "luks1" "${DEV}"
3939
# TANG server specifics
4040
port=$(tang_new_random_port)
4141
tang_run "${TMP}" "${port}"
42-
url="http://localhost:${port}"
42+
url="http://${TANGD_IP}:${port}"
4343

4444
# Initial binding to ensure luksmeta gets corrupted
4545
for ADV_NU in $(seq 0 ${ADV_AMOUNT}); do

src/luks/tests/edit-tang-luks1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ TMP="$(mktemp -d)"
3939
port=$(tang_new_random_port)
4040
tang_run "${TMP}" "${port}"
4141

42-
url="http://localhost:${port}"
42+
url="http://${TANGD_IP}:${port}"
4343

4444
cfg=$(printf '{"url":"%s"}' "${url}")
4545

@@ -67,7 +67,7 @@ fi
6767
port2=$(tang_new_random_port)
6868
TMP2="$(mktemp -d)"
6969
tang_run "${TMP2}" "${port2}"
70-
new_url="http://localhost:${port2}"
70+
new_url="http://${TANGD_IP}:${port2}"
7171
new_cfg=$(printf '{"url":"%s"}' "${new_url}")
7272

7373
if ! clevis luks edit -d "${DEV}" -s 1 -c "${new_cfg}"; then

src/luks/tests/edit-tang-luks2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ TMP="$(mktemp -d)"
3939
port=$(tang_new_random_port)
4040
tang_run "${TMP}" "${port}"
4141

42-
url="http://localhost:${port}"
42+
url="http://${TANGD_IP}:${port}"
4343

4444
cfg=$(printf '{"url":"%s"}' "${url}")
4545

@@ -67,7 +67,7 @@ fi
6767
port2=$(tang_new_random_port)
6868
TMP2="$(mktemp -d)"
6969
tang_run "${TMP2}" "${port2}"
70-
new_url="http://localhost:${port2}"
70+
new_url="http://${TANGD_IP}:${port2}"
7171
new_cfg=$(printf '{"url":"%s"}' "${new_url}")
7272

7373
if ! clevis luks edit -d "${DEV}" -s 1 -c "${new_cfg}"; then

src/luks/tests/pass-tang-luks1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ TMP=$(mktemp -d)
3535
port=$(tang_new_random_port)
3636
tang_run "${TMP}" "${port}"
3737

38-
url="http://localhost:${port}"
38+
url="http://${TANGD_IP}:${port}"
3939
adv="${TMP}/adv"
4040
tang_get_adv "${port}" "${adv}"
4141

src/luks/tests/pass-tang-luks2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ TMP=$(mktemp -d)
3535
port=$(tang_new_random_port)
3636
tang_run "${TMP}" "${port}"
3737

38-
url="http://localhost:${port}"
38+
url="http://${TANGD_IP}:${port}"
3939
adv="${TMP}/adv"
4040
tang_get_adv "${port}" "${adv}"
4141

src/luks/tests/regen-inplace-luks1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ TMP=$(mktemp -d)
3535
port=$(tang_new_random_port)
3636
tang_run "${TMP}" "${port}"
3737

38-
url="http://localhost:${port}"
38+
url="http://${TANGD_IP}:${port}"
3939
adv="${TMP}/adv"
4040
tang_get_adv "${port}" "${adv}"
4141

src/luks/tests/regen-inplace-luks2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ TMP=$(mktemp -d)
3535
port=$(tang_new_random_port)
3636
tang_run "${TMP}" "${port}"
3737

38-
url="http://localhost:${port}"
38+
url="http://${TANGD_IP}:${port}"
3939
adv="${TMP}/adv"
4040
tang_get_adv "${port}" "${adv}"
4141

0 commit comments

Comments
 (0)