Adds testing for IPv6.
Currently IPv4 is hardcoded, meaning IPv6 should not work even for the loopback interface.
This commit is contained in:
parent
4c9a99e9ce
commit
0263924386
|
@ -250,20 +250,24 @@ if [ "${RELEASE%.*}" -ge 20 ]; then
|
|||
# Assert that only loopback interface is accepted.
|
||||
interfaces=($(ip --json link show up | jq -r '.[]["ifname"] | select ( . != null )'))
|
||||
for if in ${interfaces[@]}; do
|
||||
for ipv in 4 6; do
|
||||
curl_ec=0
|
||||
timeout 10s curl "http://localhost:$port/meta/status" --interface $if || curl_ec=$?
|
||||
# Loopback should exit 0
|
||||
timeout 10s \
|
||||
curl -$ipv "http://localhost:$port/meta/status" --interface $if \
|
||||
|| curl_ec=$?
|
||||
# Loopback should exit 0 on IPv4
|
||||
if [ $if = "lo" ]; then
|
||||
if [ $curl_ec -ne 0 ]; then
|
||||
if [ $curl_ec -ne 0 -a $ipv -eq 4 ]; then
|
||||
loopback_failed=1
|
||||
fi
|
||||
# Other interfaces shoud not
|
||||
# Everything else should not.
|
||||
else
|
||||
if [ $curl_ec -eq 0 ]; then
|
||||
unallowed_failed=1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
kill $subiquity_pid
|
||||
if [ $loopback_failed -ne 0 ]; then
|
||||
echo "Loopback was expected to connect"
|
||||
|
|
Loading…
Reference in New Issue