fix: correct handling of IPv6 addresses with scope_id in ServiceInfo by bdraco · Pull Request #1322 · python-zeroconf/python-zeroconf

Skip to content

Navigation Menu

Sign in

Appearance settings

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Conversation

@bdraco

Copy link Copy Markdown

Member

@bdraco bdraco commented

Dec 10, 2023

edited

Loading

The scope_id was missing because it should come from the DNSAddress record and not the object itself if the ServiceInfo is pulling from the cache. This also lead to duplicate IPv6 records being returned because the scope id was missing

fixes #1321
fixes #1288

scope_id only works on python 3.9+ since < 3.9 doesn't support it

@codecov

Copy link Copy Markdown

codecov bot commented

Dec 10, 2023

edited

Loading

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a200842) 99.77% compared to head (fba7272) 99.77%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1322   +/-   ##
=======================================
  Coverage   99.77%   99.77%           
=======================================
  Files          29       29           
  Lines        3087     3104   +17     
  Branches      518      521    +3     
=======================================
+ Hits         3080     3097   +17     
  Misses          5        5           
  Partials        2        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bdraco bdraco changed the title Fix handling of IPv6 addresses with scope_id in ServiceInfo fix: correct handling of IPv6 addresses with scope_id in ServiceInfo

Dec 10, 2023

@bdraco

Copy link Copy Markdown

Member Author

bdraco commented

Dec 10, 2023

That test is failing because there is a precision loss with the float to double conversion.
We should make all the floats doubles ..but for another PR

@bdraco bdraco merged commit 1682991 into master

Dec 10, 2023

@bdraco bdraco deleted the fix_dupe_ipv6 branch

December 10, 2023 20:38

@twslankard

Copy link Copy Markdown

@bdraco thanks for adding this fix! I was hoping to learn more about this:

scope_id only works on python 3.9+ since < 3.9 doesn't support it

Do you have a reference for this? I'm trying to find out whether it's possible to get the scope id in Python 3.8 some other way and haven't had much luck finding more info yet.

@bdraco

Copy link Copy Markdown

Member Author

bdraco commented

Feb 3, 2024

twslankard reacted with thumbs up emoji

@twslankard

Copy link Copy Markdown

Thanks @bdraco !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Duplicate IPv6 addresses end up in ServiceInfo parsed_scoped_addresses does not return with scope_id

2 participants

@bdraco @twslankard