Module: kamailio
Branch: master
Commit: f93b336bf15ebe949ab3a2a484f5341281279d0f
URL: 
https://github.com/kamailio/kamailio/commit/f93b336bf15ebe949ab3a2a484f5341281279d0f

Author: jaybeepee <jason.pen...@gmail.com>
Committer: jaybeepee <jason.pen...@gmail.com>
Date: 2016-09-15T09:14:15+02:00

ims_usrloc_pcscf: corrected logic of service-route inner-most for-loop check

---

Modified: modules/ims_usrloc_pcscf/udomain.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/f93b336bf15ebe949ab3a2a484f5341281279d0f.diff
Patch: 
https://github.com/kamailio/kamailio/commit/f93b336bf15ebe949ab3a2a484f5341281279d0f.patch

---

diff --git a/modules/ims_usrloc_pcscf/udomain.c 
b/modules/ims_usrloc_pcscf/udomain.c
index 03f619c..b3c99b0 100644
--- a/modules/ims_usrloc_pcscf/udomain.c
+++ b/modules/ims_usrloc_pcscf/udomain.c
@@ -451,6 +451,7 @@ int get_pcontact(udomain_t* _d, pcontact_info_t* 
contact_info, struct pcontact**
        unsigned int sl, i, j, aorhash, params_len, has_rinstance=0;
        struct pcontact* c;
        struct sip_uri needle_uri;
+       int serviceroutematch;
         char *params, *sep;
         str rinstance = {0, 0};
         
@@ -535,16 +536,22 @@ int get_pcontact(udomain_t* _d, pcontact_info_t* 
contact_info, struct pcontact**
                                        LM_DBG("number of service routes do not 
match - failing\n");
                                        continue;
                                } 
+                               
+                               serviceroutematch = 1;
                                for (j=0; j<contact_info->num_service_routes; 
j++) {
                                        if (contact_info->service_routes[j].len 
!= c->service_routes[j].len || memcmp(contact_info->service_routes[j].s, 
c->service_routes[j].s, c->service_routes[j].len) != 0) {
-                                               LM_DBG("service route at 
position %d does not match - looking for [%.*s] and contact has [%.*s]... 
continuing\n", 
+                                               LM_DBG("service route at 
position %d does not match - looking for [%.*s] and contact has [%.*s]... 
continuing to next contact check\n", 
                                                        j,
                                                        
contact_info->service_routes[j].len, contact_info->service_routes[j].s,
                                                        
c->service_routes[j].len, c->service_routes[j].s);
-                                               c = c->next;
-                                               continue;
+                                               serviceroutematch = 0;
+                                               break;
                                        }
                                }
+                               if (serviceroutematch == 0) {
+                                       c = c->next;
+                                       continue;
+                               }
                        }
                        
                        //finally check state being searched for


_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to