# File lib/dnstraverse/traverser.rb, line 220
    def find_all_roots(args)
      root = args[:root] || 'localhost'
      rootip = args[:rootip] || '127.0.0.1'
      aaaa = args[:aaaa] || false
      types = aaaa ? TYPE_ARRAY_AAAA : TYPE_ARRAY_A
      Log.debug { "find_roots entry #{root}" }
      @resolver.nameserver = rootip
      # query for all the root nameservers
      msg = @resolver.query('', 'NS')
      raise msg if msg.is_a? Exception
      msg_validate(msg, :qname => '', :qtype => 'NS')
      msg_comment(msg, :want_recursion => false)
      ns = msg_answers?(msg, :qname => '', :qtype => 'NS')
      return nil unless ns
      roots = Array.new
      # look at each root in turn
      for rr in ns do
        ips = []
        # find IP addresses in the additional section
        for type in types do
          iprrs = msg_additional?(msg, :qname => rr.domainname, :qtype => type)
          if iprrs then
            ips.concat iprrs.map {|iprr| iprr.address.to_s }
          end
        end
        # if none, query for the IP addresses
        unless ips then
          Log.debug { "Locally resolving root #{rr.domainname}" }
          for type in types do
            msg = @lresolver.query(rr.domainname, type)
            msg_validate(msg, :qname => rr.domainname, :qtype => type)
            msg_comment(msg, :want_recursion => true)
            iprrs = msg_answers?(msg, :qname => rr.domainname, :qtype => type)
            if iprrs then
              ips.concat iprrs.map {|iprr| iprr.address.to_s }
            end
          end
        end
        # if we still don't have any IP address, skip this root
        unless ips.size > 0 then
          Log.warn { "Failed to resolve #{rr.domainname} type #{qtype}" }
          next
        end
        roots.push({ :name => rr.domainname, :ips => ips })
      end
      Log.debug { "find_roots exit, #{roots.map { |x| x[:name] }.join(', ') }" }
      return roots
    end