When getaddrinfo() returns an IPv6 address, connect() fails since mpd
does not support IPv6. Reproduced by adding the name "localhost" to the
"::1" entry in /etc/hosts.
Signed-off-by: Brenden Matthews <brenden@rty.ca>
+2009-05-31
+ * Fix hostname resolution for mpd_host
+
2009-05-24
* Added fancy new 'temperature gradients' feature for graphs, via the -t
switch at the end of graph arguments.
struct addrinfo *res = NULL;
struct addrinfo *addrinfo = NULL;
- /* Setup hints */
+ /* Setup hints
+ *
+ * XXX: limit address family to PF_INET here.
+ * MPD does not support IPv6 yet, so if GAI returns
+ * an IPv6 address, the later connect() will fail. */
hints.ai_flags = AI_ADDRCONFIG;
- hints.ai_family = PF_UNSPEC;
+ hints.ai_family = PF_INET;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
hints.ai_addrlen = 0;