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

nghttp2-asio: resolve numeric IPv6 server address #771

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sgsx3
Copy link

@sgsx3 sgsx3 commented Oct 28, 2024

The boost library refuses to resolve a numeric IPv6 host (::1) because its resolver flags are set to 'address_configured' by default. This patch simply runs an additional query in such a case with flags set to 'numeric_host'.

See https://www.boost.org/doc/libs/1_83_0/doc/html/boost_asio/reference/ip__resolver_base.html for more info.

Fixes #751

Description

Checklist

Tick relevant boxes, this PR is-a or has-a:

  • Bugfix
    • Regression tests
    • ChangeLog updates (for next release)
  • Feature
    • YANG model change => revision updated?
    • Regression tests added?
    • ChangeLog updates (for next release)
    • Documentation added?
  • Test changes
    • Checked in changed Readme.adoc (make test-spec)
    • Added new test to group Readme.adoc and yaml file
  • Code style update (formatting, renaming)
  • Refactoring (please detail in commit messages)
  • Build related changes
  • Documentation content changes
    • ChangeLog updated (for major changes)
  • Other (please describe):

The boost library refuses to resolve a numeric IPv6 host (::1) because its resolver flags are set to 'address_configured' by default.
This patch simply runs an additional query in such a case with flags set to 'numeric_host'.

See https://www.boost.org/doc/libs/1_83_0/doc/html/boost_asio/reference/ip__resolver_base.html for more info.

Fixes kernelkit#751

Signed-off-by: Stefan Schlosser <[email protected]>
@sgsx3
Copy link
Author

sgsx3 commented Oct 28, 2024

Second attempt, hope the formal stuff is fine now.

Haven't tested this on x86 because I think it's a generic issue. The boost library calls getaddrinfo(3), if AI_NUMERICHOST is not set in hints.ai_flags, then lookup is performed based on nsswitch.conf(5) and hosts(5).

127.0.0.1 works for me but then I would need to change /etc/nginx/restconf.app.
When I add ::1 ip6-localhost to /etc/hosts ::1 still doesn't resolve. If I use ip6-localhost it binds to 127.0.0.1, though.

@troglobit
Copy link
Contributor

Minor comment on the formals, we update the ChangeLog on all user-facing fixes. In this case it would be great if you could add, to the ### Fixes section of the next release, something like:

- Fix #751: RESTCONF agent crashes on NanoPi R2S when system has no IPv6 address 
  (other than loopback), possibly affects other platforms as well

Btw, it's perfectly OK to force-push to branches connected to a PR, or push follow-up commits. You don't need to create a new PR. Thanks for hanging in there! 😃

@mattiaswal
Copy link
Contributor

If IPv4 works, but not IPv6, i feel the proper fix is to change rousette to listen on IPv4 (127.0.0.1) for now and change nginx as you describe. IPv6 seems buggy somewhere (boost? nghttp2-asio?)

Thanks for the clarification about the bug! Broken IPv6 resolver (most likely in boost) I can live with.

@mattiaswal mattiaswal self-requested a review October 28, 2024 18:46
@troglobit
Copy link
Contributor

If IPv4 works, but not IPv6, i feel the proper fix is to change rousette to listen on IPv4 (127.0.0.1) for now and change nginx as you describe. IPv6 seems buggy somewhere (boost? nghttp2-asio?)

Agreed.

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.

R2S rousette crash on boot if LAN not connected
3 participants