anchor.diff:  %% match data field directly and cache RRs.
   %%
   res_hostent_by_domain(Domain, Type, Rec) ->
  -    res_cache_answer(Rec),
  -    RRs = Rec#dns_rec.anlist,
  +    RRs = lists:map(fun lower_rr/1, Rec#dns_rec.anlist),
  +    res_cache_answer(Rec#dns_rec{anlist = RRs}),
       ?dbg("res_hostent_by_domain: ~p - ~p~n", [Domain, RRs]),
  -    res_hostent_by_domain(stripdot(Domain), [], Type, RRs).
  -
  -res_hostent_by_domain(Domain, Aliases, Type, RRs) ->
  -    case res_lookup_type(Domain, Type, RRs) of
  +    res_hostent_by_domain(stripdot(Domain), [], [], Type, RRs).
  +
  +res_hostent_by_domain(Domain, Aliases, LAliases, Type, RRs) ->
  +    LDomain = tolower(Domain),
  +    case res_lookup_type(LDomain, Type, RRs) of
   	[] ->
  -	    case res_lookup_type(Domain, ?S_CNAME, RRs) of
  +	    case res_lookup_type(LDomain, ?S_CNAME, RRs) of
   		[] ->  
   		    {error, nxdomain};
   		[CName | _] ->
  -		    case lists:member(CName, [Domain | Aliases]) of
  +		    case lists:member(tolower(CName), [LDomain | LAliases]) of
   			true -> 
   			    {error, nxdomain};
   			false ->
   			    res_hostent_by_domain(CName, [Domain | Aliases],
  -						  Type, RRs)
  +						  [LDomain | LAliases], Type,
  +						  RRs)
   		    end
   	    end;
   	Addrs ->
  
positive.code: %%
  res_gethostbyaddr(IP, Rec) ->
      {ok, {IP1, HType, HLen}} = dnt(IP),
      res_cache_answer(Rec),
      ent_gethostbyaddr(Rec#dns_rec.anlist, IP1, HType, HLen).
  
  ent_gethostbyaddr(RRs, IP, AddrType, Length) ->
  
negative.code: %% lookup and remove old entries
  
  do_lookup_rr(Domain, Class, Type) ->
      match_rr(#dns_rr{domain = tolower(Domain), class = Class,type = Type,
  		     cnt = '_', tm = '_', ttl = '_',
  		     bm = '_', func = '_', data = '_'}).
  
  