[sr-dev] git:5.2:32c110ce: cdp: better compatiblity with certain Diameter servers

Henning Westerholt hw at skalatan.de
Wed Jun 10 17:39:15 CEST 2020


Module: kamailio
Branch: 5.2
Commit: 32c110cea12f3653b4d110d307e17df42bd79b6a
URL: https://github.com/kamailio/kamailio/commit/32c110cea12f3653b4d110d307e17df42bd79b6a

Author: Henning Westerholt <hw at skalatan.de>
Committer: Henning Westerholt <hw at skalatan.de>
Date: 2020-06-10T15:38:56Z

cdp: better compatiblity with certain Diameter servers

- better compatiblity with certain Diameter servers
- some Diameter servers do not include Supported-Vendor-Id AVP in their reply
- assume in this case that the server will support our proposed applications

(cherry picked from commit 1a462ed4cffddd5f691b33adb859c286a0c074df)

---

Modified: src/modules/cdp/peerstatemachine.c

---

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

---

diff --git a/src/modules/cdp/peerstatemachine.c b/src/modules/cdp/peerstatemachine.c
index ed49a3ad30..b83654bf1d 100644
--- a/src/modules/cdp/peerstatemachine.c
+++ b/src/modules/cdp/peerstatemachine.c
@@ -678,7 +678,8 @@ void add_peer_application(peer *p, int id, int vendor, app_type type)
 	p->applications[p->applications_cnt].id = id;
 	p->applications[p->applications_cnt].vendor = vendor;
 	p->applications[p->applications_cnt].type = type;
-	LM_DBG("Application %i of maximum %i\n", p->applications_cnt, p->applications_max);
+	LM_DBG("Application number %i with id %d and vendor %d added, maximum %i\n",
+			p->applications_cnt, id, vendor, p->applications_max);
 	p->applications_cnt++;
 }
 
@@ -715,6 +716,12 @@ void save_peer_applications(peer *p,AAAMessage *msg)
 
 	supported_vendor_id_avp_cnt = count_Supported_Vendor_Id_AVPS(msg);
 
+	if (supported_vendor_id_avp_cnt == 0) {
+		LM_INFO("No Supported-Vendor-Id AVP found, assuming compability with %d vendor(s) from our CER msg\n",
+				config->supported_vendors_cnt);
+				supported_vendor_id_avp_cnt = 1;
+	}
+
 	for(avp=msg->avpList.head;avp;avp = avp->next)
 
 		switch (avp->code){
@@ -728,6 +735,8 @@ void save_peer_applications(peer *p,AAAMessage *msg)
 				total_cnt+=2;/* wasteful, but let's skip decoding */
 				break;
 		}
+	LM_DBG("Total count of applications is %d\n", total_cnt);
+
 	p->applications_cnt = 0;
 	p->applications = shm_malloc(sizeof(app_config)*total_cnt);
 	p->applications_max = total_cnt;
@@ -745,7 +754,6 @@ void save_peer_applications(peer *p,AAAMessage *msg)
 				add_peer_application(p,id,0,DP_AUTHORIZATION);
 				avp_vendor = AAAFindMatchingAVP(msg,0,AVP_Supported_Vendor_Id,0,0);
 				while (avp_vendor) {
-
 					vendor = get_4bytes(avp_vendor->data.s);
 					LM_DBG("Found Supported Vendor for Application %i: %i\n", DP_AUTHORIZATION, vendor);
 					add_peer_application(p,id,vendor,DP_AUTHORIZATION);




More information about the sr-dev mailing list