Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pennbauman
Copy link
Contributor

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.

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]>
Copy link
Member

@debarshiray debarshiray left a 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; \
Copy link
Member

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}
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants