Skip to content
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

Add dns.edns.Option.to_generic() #1145

Merged
merged 3 commits into from
Oct 11, 2024
Merged

Conversation

bwelling
Copy link
Collaborator

@bwelling bwelling commented Oct 9, 2024

Converts an EDNS option represented by a custom class into an equivalent option represented by the generic option class. This is similar to the existing dns.rdata.Rdata.to_generic() method.

Also, adds a specialization to the existing dns.rdata.Rdata.to_generic() method for GenericRdata, to avoid extra work for applications that want to convert all rdata to generic form.

Converts an EDNS option represented by a custom class into an equivalent
option represented by the generic option class.  This is similar to the
existing dns.rdata.Rdata.to_generic() method.

Also, adds a specialization to the existing dns.rdata.Rdata.to_generic()
method for GenericRdata, to avoid extra work for applications that want
to convert all rdata to generic form.
@rthalley rthalley merged commit 91d329a into rthalley:main Oct 11, 2024
9 of 10 checks passed
@chenrui333
Copy link

I have tested the patch in Homebrew/homebrew-core#193954, but still seeing the same issue

==> /opt/homebrew/Cellar/dnsviz/0.11.0/bin/dnsviz probe -d 0 -r example.com-probe-auth.json -o example.com.json
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/dnsviz/0.11.0/bin/dnsviz", line 159, in <module>
    main()
    ~~~~^^
  File "/opt/homebrew/Cellar/dnsviz/0.11.0/bin/dnsviz", line 156, in main
    mod.main(args)
    ~~~~~~~~^^^^^^
  File "/opt/homebrew/Cellar/dnsviz/0.11.0/libexec/lib/python3.13/site-packages/dnsviz/commands/probe.py", line 1571, in main
    name_objs.append(OnlineDomainNameAnalysis.deserialize(name, arghelper.analysis_structured, cache))
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/dnsviz/0.11.0/libexec/lib/python3.13/site-packages/dnsviz/analysis/online.py", line 943, in deserialize
    a._deserialize_related(d)
    ~~~~~~~~~~~~~~~~~~~~~~^^^
  File "/opt/homebrew/Cellar/dnsviz/0.11.0/libexec/lib/python3.13/site-packages/dnsviz/analysis/online.py", line 1003, in _deserialize_related
    self.add_query(Q.DNSQuery.deserialize(query, bailiwick_map, default_bailiwick, cookie_jar_map, default_cookie_jar, cookie_standin, cookie_bad), detect_ns, detect_cookies)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/dnsviz/0.11.0/libexec/lib/python3.13/site-packages/dnsviz/analysis/online.py", line 524, in add_query
    self._process_response(query.responses[server][client], server, client, query, bailiwick, detect_ns, detect_cookies)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/dnsviz/0.11.0/libexec/lib/python3.13/site-packages/dnsviz/analysis/online.py", line 406, in _process_response
    self._set_server_cookies(response, server)
    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/dnsviz/0.11.0/libexec/lib/python3.13/site-packages/dnsviz/analysis/online.py", line 366, in _set_server_cookies
    server_cookie = response.get_server_cookie()
  File "/opt/homebrew/Cellar/dnsviz/0.11.0/libexec/lib/python3.13/site-packages/dnsviz/response.py", line 325, in get_server_cookie
    if cookie_opt is not None and len(cookie_opt.data) > 8:
                                      ^^^^^^^^^^^^^^^
AttributeError: 'CookieOption' object has no attribute 'data'

@rthalley
Copy link
Owner

This won't help dnsviz in the near term, this is to help avoid these issues in the future. Dnsviz will still have to do the workarounds Casey mentioned, or pin dnspython to 2.6.1.

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.

3 participants