diff options
-rwxr-xr-x | mdns-resolver | 12 |
1 files changed, 11 insertions, 1 deletions
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| |