-
Notifications
You must be signed in to change notification settings - Fork 236
test/system: Fix issue with python resolver IP type #1598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking into this @pennbauman ! It took me while to figure out what's going on - clearly I don't know Python or networking at all. :D
Let me see if I got it right.
You are beginning to accumulate some non-trivial commits in the project. You should consider adding yourself to the copyright notices of the files you have touched.
@@ -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; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, family
was getting overwritten to 0
in the second line if sys.argv[1]
is "A"
, right?
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} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we missing a trailing semi-colon?
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.