From b4608ac16c27647721dfe5ee56bf9709a827c486 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 13 May 2012 04:38:46 +0200 Subject: Fix IPv6 resolve on systems that only return IPv4 addresses by default --- mdns-resolver | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mdns-resolver b/mdns-resolver index 762f8d9..592c754 100755 --- a/mdns-resolver +++ b/mdns-resolver @@ -96,7 +96,17 @@ while run do begin addresses = Set.new - Socket.getaddrinfo(host+'.local.', nil).each { |addr| addresses << [addr[0], addr[3]] } + begin + Socket.getaddrinfo(host+'.local.', nil, :INET).each { |addr| addresses << [addr[0], addr[3]] } + rescue + end + + begin + Socket.getaddrinfo(host+'.local.', nil, :INET6).each { |addr| addresses << [addr[0], addr[3]] } + rescue + end + + raise if addresses.empty? if q.qType.to_i == Net::DNS::A or q.qType.to_i == Net::DNS::ANY addresses.each do |addr| -- cgit v1.2.3