Browse code

dns: naptr local preferences fix

- in some cases the local preference for a protocol
(dns_{udp,tcp,sctp,tls}_pref) was ignored (depending on the
order of the records).

Reported-by: Vladimir Broz, vbroz at iptel org
Tested-by: Vladimir Broz, vbroz at iptel org

Andrei Pelinescu-Onciul authored on 03/12/2008 23:41:13
Showing 1 changed files
... ...
@@ -896,8 +896,9 @@ int naptr_choose (struct naptr_rdata** crt, char* crt_proto,
896 896
 	if ((*crt==0) || ((*crt_proto!=n_proto) && 
897 897
 						( naptr_proto_preferred(n_proto, *crt_proto))) )
898 898
 			goto change;
899
-	if ((n->order<(*crt)->order) || ((n->order== (*crt)->order) &&
900
-									(n->pref < (*crt)->pref))){
899
+	if (!naptr_proto_preferred(*crt_proto, n_proto) && 
900
+			((n->order<(*crt)->order) || ((n->order== (*crt)->order) &&
901
+								(n->pref < (*crt)->pref)))){
901 902
 			goto change;
902 903
 	}
903 904
 #ifdef NAPTR_DBG