[SR-Dev] git:ser_core_cvs: dns: naptr local preferences fix

Andrei Pelinescu-Onciul andrei at iptel.org
Tue Dec 16 16:02:51 CET 2008


Module: sip-router
Branch: ser_core_cvs
Commit: 218c9f41a2350ce177a56e3679a0a67dccc796d3
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=218c9f41a2350ce177a56e3679a0a67dccc796d3

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Wed Dec  3 23:41:13 2008 +0000

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

---

 resolve.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/resolve.c b/resolve.c
index 94e0558..16c79de 100644
--- a/resolve.c
+++ b/resolve.c
@@ -896,8 +896,9 @@ int naptr_choose (struct naptr_rdata** crt, char* crt_proto,
 	if ((*crt==0) || ((*crt_proto!=n_proto) && 
 						( naptr_proto_preferred(n_proto, *crt_proto))) )
 			goto change;
-	if ((n->order<(*crt)->order) || ((n->order== (*crt)->order) &&
-									(n->pref < (*crt)->pref))){
+	if (!naptr_proto_preferred(*crt_proto, n_proto) && 
+			((n->order<(*crt)->order) || ((n->order== (*crt)->order) &&
+								(n->pref < (*crt)->pref)))){
 			goto change;
 	}
 #ifdef NAPTR_DBG




More information about the sr-dev mailing list