Project

General

Profile

Feature #14922 ยป resolv-use_ipv6-14922.patch

jeremyevans0 (Jeremy Evans), 08/27/2019 03:36 AM

View differences:

lib/resolv.rb
82 82
  ##
83 83
  # Creates a new Resolv using +resolvers+.
84 84

  
85
  def initialize(resolvers=[Hosts.new, DNS.new])
86
    @resolvers = resolvers
85
  def initialize(resolvers=nil, use_ipv6: nil)
86
    @resolvers = resolvers || [Hosts.new, DNS.new(DNS::Config.default_config_hash.merge(use_ipv6: use_ipv6))]
87 87
  end
88 88

  
89 89
  ##
......
409 409
    end
410 410

  
411 411
    def use_ipv6? # :nodoc:
412
      use_ipv6 = @config.use_ipv6?
413
      unless use_ipv6.nil?
414
        return use_ipv6
415
      end
416

  
412 417
      begin
413 418
        list = Socket.ip_address_list
414 419
      rescue NotImplementedError
......
1002 1007
        @mutex.synchronize {
1003 1008
          unless @initialized
1004 1009
            @nameserver_port = []
1010
            @use_ipv6 = nil
1005 1011
            @search = nil
1006 1012
            @ndots = 1
1007 1013
            case @config_info
......
1026 1032
            if config_hash.include? :nameserver_port
1027 1033
              @nameserver_port = config_hash[:nameserver_port].map {|ns, port| [ns, (port || Port)] }
1028 1034
            end
1035
            if config_hash.include? :use_ipv6
1036
              @use_ipv6 = config_hash[:use_ipv6]
1037
            end
1029 1038
            @search = config_hash[:search] if config_hash.include? :search
1030 1039
            @ndots = config_hash[:ndots] if config_hash.include? :ndots
1031 1040

  
......
1081 1090
        @nameserver_port
1082 1091
      end
1083 1092

  
1093
      def use_ipv6?
1094
        @use_ipv6
1095
      end
1096

  
1084 1097
      def generate_candidates(name)
1085 1098
        candidates = nil
1086 1099
        name = Name.create(name)
1087
-