Skip to content

query TYPE_A and TYPE_AAAA via Command::Resolve - #185

Merged
keepsimple1 merged 4 commits into
keepsimple1:mainfrom
hrzlgnm:fix-resolve-zeroconf-systemd-resolved
Mar 20, 2024
Merged

keepsimple1 merged 4 commits into
keepsimple1:mainfrom
hrzlgnm:fix-resolve-zeroconf-systemd-resolved

Conversation

@hrzlgnm

@hrzlgnm hrzlgnm commented Mar 19, 2024 •

Copy link
Copy Markdown
Contributor

This fixes issues with resolving records published by python-zeroconf or systemd-resolved without an actual A or AAAA address assigned.

Closes #182

Manually tested on linux and windows successfully

@hrzlgnm hrzlgnm changed the title Send A and AAAA queries if we have only a hostname form SRV Send A and AAAA queries if we only got a hostname form a SRV record Mar 19, 2024

@keepsimple1 keepsimple1 left a comment •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for coming up with the fix! Good work! I have two comments:

  1. Should we use the existing Command::Resolve to send this query? The reason is that it is possible that the responses came in more than 1 DnsIncoming datagram. This will give it a chance to process completely. It will also handle retry.

I opened PR #186 to show what I meant.

  1. As an optimization, we can refactor send_query to accept more than 1 type so that we can ask more than 1 questions in the packet. So we can reduce the network traffic. (We / I can do this later, just a comment here)

@hrzlgnm

hrzlgnm commented Mar 20, 2024

Copy link
Copy Markdown
Contributor Author

Thanks for coming up with the fix! Good work! I have two comments:

1. Should we use the existing `Command::Resolve` to send this query? The reason is that it is possible that the responses came in more than 1 `DnsIncoming` datagram. This will give it a chance to process completely.  It will also handle retry.

I opened PR #186 to show what I meant.

2. As an optimization, we can refactor `send_query` to accept more than 1 type so that we can ask more than 1 questions in the packet. So we can reduce the network traffic. (We  / I can do this later, just a comment here)

Regarding 1. yes that makes more sense to me as we wouldn't retry endlessly if we never receive a reply.

Regarding 2: yes makes sense to send multiple queries in one packet to reduce network traffic.

@keepsimple1

Copy link
Copy Markdown
Owner

Regarding 1. yes that makes more sense to me as we wouldn't retry endlessly if we never receive a reply.

Regarding 2: yes makes sense to send multiple queries in one packet to reduce network traffic.

I think at least two options we can do:

a) Merge your current changes in this PR and then I will follow up with changes using the other PR. And will need your help to verify your use case still works.

b) You can update this PR with suggestion changes (particularly 1) and we merge it.

I'm good with either approaches. Let me know what you think?

@hrzlgnm

hrzlgnm commented Mar 20, 2024

Copy link
Copy Markdown
Contributor Author

I'd rather do b to avoid the unclean intermediate state

@hrzlgnm

hrzlgnm commented Mar 20, 2024

Copy link
Copy Markdown
Contributor Author

I'll update my pr after work

@hrzlgnm

hrzlgnm commented Mar 20, 2024

Copy link
Copy Markdown
Contributor Author

Update the PR and retested my 2 cases successfully on windows and linux.

@hrzlgnm
hrzlgnm requested a review from keepsimple1 March 20, 2024 16:34
@hrzlgnm hrzlgnm changed the title Send A and AAAA queries if we only got a hostname form a SRV record query TYPE_A and TYPE_AAAA via Command::Resolve Mar 20, 2024
@hrzlgnm

hrzlgnm commented Mar 20, 2024

Copy link
Copy Markdown
Contributor Author

And thank you very much for the explanatory PR, it was very educational 👍

@keepsimple1 keepsimple1 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the update! LGTM!

@keepsimple1
keepsimple1 merged commit e6fa83b into keepsimple1:main Mar 20, 2024
@hrzlgnm
hrzlgnm deleted the fix-resolve-zeroconf-systemd-resolved branch March 20, 2024 17:52
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.

Services published using python-zerconf or systemd-resolved are not resolved

2 participants