test/system: Fix issue with python resolver IP type

The existing code would never properly select the IPv4 address
instead a fallback value was selected when the IPv4 option was
used, the script is updated to that both IPv4 and IPv6 will be
properly selected.

Signed-off-by: Penn Bauman <me@pennbauman.com>
This commit is contained in:
Penn Bauman 2024-11-29 01:29:21 -08:00
parent b378596b14
commit 0fd5be4443
1 changed files with 2 additions and 3 deletions

View File

@ -24,9 +24,8 @@ load 'libs/helpers'
readonly RESOLVER_PYTHON3='\
import socket; \
import sys; \
family = socket.AddressFamily.AF_INET if sys.argv[1] == "A" else 0; \
family = socket.AddressFamily.AF_INET6 if sys.argv[1] == "AAAA" else 0; \
addr = socket.getaddrinfo(sys.argv[2], None, family, socket.SocketKind.SOCK_RAW)[0][4][0]; \
family = {"A": socket.AddressFamily.AF_INET, "AAAA": socket.AddressFamily.AF_INET6}
addr = socket.getaddrinfo(sys.argv[2], None, family[sys.argv[1]], socket.SocketKind.SOCK_RAW)[0][4][0]; \
print(addr)'
# shellcheck disable=SC2016