anchor.diff:  	{ok, Received} ->
   	    case address_to_address_and_proto(Received, Proto) of
   		{error, E1} ->
  -		    logger:log(debug, "Warning: Malformed received= parameter (~p) : ~p", [E1, Received]),
  +		    logger:log(debug, "Warning: Malformed received= parameter (~p) : ~p", [Received, E1]),
   		    %% received= parameter not usable, try host part of Via instead
   		    %% XXX try to resolve host part of Via if necessary
   		    case address_to_address_and_proto(Host, Proto) of
  -			{error, _E2} ->
  -			    logger:log(debug, "Warning: Invalid host part of Via (~p) : ~p", [E1, Host]),
  +			{error, E2} ->
  +			    logger:log(debug, "Warning: Invalid host part of Via (~p) : ~p", [Host, E2]),
   			    logger:log(error, "Failed getting a response destination out of Via : ~p", [TopVia]),
   			    error;
  -			R ->
  -			    R
  +			{ok, Address1, Proto1} ->
  +			    {ok, Address1, Proto1}
   		    end;
  -		R ->
  -		    R
  +		{ok, Address1, Proto1} ->
  +		    {ok, Address1, Proto1}
   	    end;
  -	_Res ->
  +	_ ->
   	    %% There was no received= parameter. Do the same checks but on the Via
   	    %% hostname (which is then almost certainly an IP-address).
   	    case address_to_address_and_proto(Host, Proto) of
  -		{error, E3} ->
  -		    logger:log(debug, "Warning: No received= and invalid host part of Via (~p) : ~p", [E3, Host]),
  +		{error, E1} ->
  +		    logger:log(debug, "Warning: No received= and invalid host part of Via (~p) : ~p", [Host, E1]),
   		    logger:log(error, "Failed getting a response destination out of Via : ~p", [TopVia]),
   		    error;
  -		R ->
  -		    R
  +		{ok, Address1, Proto1} ->
  +		    {ok, Address1, Proto1}
   	    end
       end.
   
  
positive.code:     [TCP6, UDP6] = remove_tls_destinations([TLS6, TCP6, TLS4, UDP6, TLS4]),
  
  
      %% test make_sipdst_from_hostport/3
      %%--------------------------------------------------------------------
      URL = sipurl:parse("sip:ft@example.org:1234"),
  
      io:format("test: make_sipdst_from_hostport/3 - 1~n"),
      %% simple case, tcp and no supplied port in the tuple
      Tuple1 = {inet, "address", none},
      Dst1 = #sipdst{proto=tcp, addr="address", port=5060, uri=URL},
      [Dst1] = make_sipdst_from_hostport(tcp, URL, [Tuple1]),
  
      io:format("test: make_sipdst_from_hostport/3 - 2~n"),
      %% tcp 'upped' to tcp6 since tuple protocol is inet6. port from tuple used.
      Tuple2 = {inet6, "address", 5070},
      Dst2 = #sipdst{proto=tcp6, addr="address", port=5070, uri=URL},
      [Dst2] = make_sipdst_from_hostport(tcp, URL, [Tuple2]),
  
      io:format("test: make_sipdst_from_hostport/3 - 3~n"),
      %% mixed
      [Dst1, Dst2] = make_sipdst_from_hostport(tcp, URL, [Tuple1, Tuple2]),
  
  
      %% test get_response_host_proto/1
      %% NOTE: We can currently only test with IPv4 addresses since IPv6 is
      %% off by default, so when the tests are run enable_v6 might not be
      %% 'true'.
  
negative.code: %%           DstList = list() of sipdst record()
  %%           Reason  = string()
  %%--------------------------------------------------------------------
  make_sipdst_from_hostport(Proto, URI, SSLHost, In) when Proto == tcp; Proto == udp; Proto == tls,
  							is_record(URI, sipurl), is_list(SSLHost), is_list(In) ->
      make_sipdst_from_hostport2(Proto, URI, SSLHost, In, []).
  
  %%
  %% sipdns_hostport.family == inet
  %%
  make_sipdst_from_hostport2(Proto, URI, SSLHost, [#sipdns_hostport{family=inet}=H | T], Res) ->
      UsePort = siprequest:default_port(Proto, H#sipdns_hostport.port),
      This = #sipdst{proto=Proto,
  		   addr=H#sipdns_hostport.addr,
  		   port=UsePort,
  		   uri=URI,
  		   ssl_hostname=SSLHost},
      make_sipdst_from_hostport2(Proto, URI, SSLHost, T, [This | Res]);
  %%
  %% sipdns_hostport.family == inet6
  %%
  make_sipdst_from_hostport2(Proto, URI, SSLHost, [#sipdns_hostport{family=inet6}=H | T], Res) ->
      %% inet6 family, must turn Proto into IPv6 variant
      UseProto = case Proto of
  		   tcp -> tcp6;
  		   udp -> udp6;
  		   tls -> tls6
  	       end,
      UsePort = siprequest:default_port(UseProto, H#sipdns_hostport.port),
      This = #sipdst{proto=UseProto,
  		   addr=H#sipdns_hostport.addr,
  		   port=UsePort,
  		   uri=URI,
  		   ssl_hostname=SSLHost},
      make_sipdst_from_hostport2(Proto, URI, SSLHost, T, [This | Res]);
  %%
  %% No more input
  %%
  make_sipdst_from_hostport2(_Proto, _URI, _SSLHost, [], Res) ->
      lists:reverse(Res).
  
  
  %%--------------------------------------------------------------------
  %% Function: format_siplookup_result(InPort, ReqURI, SSLHost, DstList)
  %%           InPort        = integer() | none
  %%           ReqURI        = sipurl record()
  %%           SSLHost       = string() | undefined
  %%           DstList       = list() of {Proto, Host, Port} tuple()
  %% Descrip.: Turns the result of a dnsutil:siplookup() into a list
  %%           of sipdst records. The ordering is preserved.
  %% Returns : DstList, list() of sipdst record()
  %%--------------------------------------------------------------------
  format_siplookup_result(InPort, ReqURI, SSLHost, DstList)
    when is_integer(InPort) ; InPort == none, is_record(ReqURI, sipurl), is_list(SSLHost) ; SSLHost == undefined,
         is_list(DstList) ->
      format_siplookup_result2(InPort, ReqURI, SSLHost, DstList, []).
  
  format_siplookup_result2(_InPort, _ReqURI, _SSLHost, [], Res) ->
      Res;
  format_siplookup_result2(InPort, ReqURI, SSLHost, [H | T], Res) when is_record(H, sipdns_srv) ->
      {Proto, Host, Port} = {H#sipdns_srv.proto, H#sipdns_srv.host, H#sipdns_srv.port},
      %% If InPort is 'none', then use the port from DNS. Otherwise, use InPort.
      %% This is to handle if we for example receive a request with a Request-URI of
      %% sip.example.net:5070, and sip.example.net has SRV-records saying port 5060. In
      %% that case, we should still send our request to port 5070.
  