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

Setting mpd/hostname to a DNS address breaks IPV4 if hostname is IPV6 enabled. #6

Open
adamcik opened this issue Jul 28, 2014 · 2 comments
Labels
C-bug Category: This is a bug

Comments

@adamcik
Copy link
Member

adamcik commented Jul 28, 2014

Currently we create a socket using socket.socket(socket.AF_INET6, socket.SOCK_STREAM) and then calling bind. However, if the address given to bind is not an address it gets automatically resolved at which point we have no control over if the IPV4 or IPV6 address is actually used.

Correct way to handle this is to use socket.getaddrinfo(addr, None, socket.AF_UNSPEC, socket.SOCK_STREAM, 0, socket.AI_PASSIVE) and create a socket for each of the addresses we found.

@jodal
Copy link
Member

jodal commented Jul 29, 2014

This sounds like exactly how Tornado does this. Maybe we should just use their method?

http://www.tornadoweb.org/en/stable/netutil.html#tornado.netutil.bind_sockets

If we go that path, I also suggest to make an empty mpd/hostname and http/hostname config equal to ::: e.g. bind to all interfaces.

@adamcik
Copy link
Member Author

adamcik commented Jul 29, 2014

Correct, that is exactly how they do it, with some details left out for brevity. And yes I did consider just using their code for this.

@jodal jodal transferred this issue from mopidy/mopidy Dec 20, 2019
@jodal jodal added the C-bug Category: This is a bug label Dec 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

2 participants