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

Fix protocol being treated as family in getaddrinfo inputs/outputs #538

Merged
merged 2 commits into from
Apr 18, 2021

Conversation

squeek502
Copy link
Member

Follow up to #534 (comment)

The Get all adresses for luvit.io test in test-dns.lua now gives:

    { addr = "206.189.225.172", family = "inet", protocol = "tcp", socktype = "stream" },
    { addr = "206.189.225.172", family = "inet", protocol = "udp", socktype = "dgram" },
    { addr = "206.189.225.172", family = "inet", protocol = "ip", socktype = "raw" },
    { addr = "2604:a880:400:d0::1b9f:2001", family = "inet6", protocol = "tcp", socktype = "stream" },
    { addr = "2604:a880:400:d0::1b9f:2001", family = "inet6", protocol = "udp", socktype = "dgram" },
    { addr = "2604:a880:400:d0::1b9f:2001", family = "inet6", protocol = "ip", socktype = "raw" }

which has the correct protocols.


Protocol hinting also works, e.g.

local uv = require('luv')

uv.getaddrinfo("luvit.io", nil, {
  protocol = "udp",
}, function (err, res)
  assert(not err, err)
  for i, addr in ipairs(res) do
    print("["..i.."]:")
    for k,v in pairs(addr) do
      print('',k,v)
    end
  end
end)

uv.run()

will give

[1]:
	addr	206.189.225.172
	family	inet
	socktype	dgram
	protocol	udp
[2]:
	addr	2604:a880:400:d0::1b9f:2001
	family	inet6
	socktype	dgram
	protocol	udp

@squeek502 squeek502 changed the title Protocol Fix protocol being treated as family in getaddrinfo inputs/outputs Apr 18, 2021
@zhaozg zhaozg merged commit b85b9ef into luvit:master Apr 18, 2021
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