[sr-dev] git:master:e10dc0db: ims_ipsec_pcscf: extend get_pcontact with the new parameter.

Henning Westerholt hw at skalatan.de
Wed Aug 12 20:44:17 CEST 2020


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

Author: Aleksandar Yosifov <alexyosifov at gmail.com>
Committer: Henning Westerholt <hw at skalatan.de>
Date: 2020-08-12T20:44:08+02:00

ims_ipsec_pcscf: extend get_pcontact with the new parameter.

- added a new bitwise value for _cflags in ipsec_forward.
- performing a reverse search for a contact in ipsec_forward
  if the new flag IPSEC_REVERSE_SEARCH is set.

---

Modified: src/modules/ims_ipsec_pcscf/cmd.c
Modified: src/modules/ims_ipsec_pcscf/doc/ims_ipsec_pcscf_admin.xml

---

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

---

diff --git a/src/modules/ims_ipsec_pcscf/cmd.c b/src/modules/ims_ipsec_pcscf/cmd.c
index 16a62f8e6e..e63e9315de 100644
--- a/src/modules/ims_ipsec_pcscf/cmd.c
+++ b/src/modules/ims_ipsec_pcscf/cmd.c
@@ -76,6 +76,7 @@ extern usrloc_api_t ul;
 extern struct tm_binds tmb;
 
 #define IPSEC_SEND_FORCE_SOCKET		0x01 /* if set - set send force socket for request messages */
+#define IPSEC_REVERSE_SEARCH		0x02 /* if set - start seraching from the last element */
 
 int bind_ipsec_pcscf(ipsec_pcscf_api_t* api) {
 	if(!api){
@@ -663,7 +664,7 @@ int ipsec_create(struct sip_msg* m, udomain_t* d)
 
     ul.lock_udomain(d, &ci.via_host, ci.via_port, ci.via_prot);
 
-    if (ul.get_pcontact(d, &ci, &pcontact) != 0) {
+    if (ul.get_pcontact(d, &ci, &pcontact, 0) != 0) {
         LM_ERR("Contact doesn't exist\n");
         goto cleanup;
     }
@@ -802,7 +803,7 @@ int ipsec_forward(struct sip_msg* m, udomain_t* d, int _cflags)
 
     ul.lock_udomain(d, &ci.via_host, ci.via_port, ci.via_prot);
 
-    if (ul.get_pcontact(d, &ci, &pcontact) != 0) {
+    if (ul.get_pcontact(d, &ci, &pcontact, _cflags & IPSEC_REVERSE_SEARCH) != 0) {
         LM_ERR("Contact doesn't exist\n");
         goto cleanup;
     }
@@ -946,7 +947,7 @@ int ipsec_destroy(struct sip_msg* m, udomain_t* d)
 
     ul.lock_udomain(d, &ci.via_host, ci.via_port, ci.via_prot);
 
-    if (ul.get_pcontact(d, &ci, &pcontact) != 0) {
+    if (ul.get_pcontact(d, &ci, &pcontact, 0) != 0) {
         LM_ERR("Contact doesn't exist\n");
         goto cleanup;
     }
diff --git a/src/modules/ims_ipsec_pcscf/doc/ims_ipsec_pcscf_admin.xml b/src/modules/ims_ipsec_pcscf/doc/ims_ipsec_pcscf_admin.xml
index 95b44f2c90..3d2a19efc9 100644
--- a/src/modules/ims_ipsec_pcscf/doc/ims_ipsec_pcscf_admin.xml
+++ b/src/modules/ims_ipsec_pcscf/doc/ims_ipsec_pcscf_admin.xml
@@ -243,8 +243,9 @@ ipsec_create("location");
           stores the contacts.
           </para>
           <para>
-          <emphasis>flags</emphasis> - Set send force socket for request messages.
-          If 1 - set force socket for request messages. Useful for ipsec and TCP.
+          <emphasis>flags</emphasis> - bitwise flag:
+          0x01 - set force socket for request messages. Useful for ipsec and TCP.
+          0x02 - reverse search for a contact in the memory. Useful when contact alias is disabled.
           This is an optional parameter, default value - 0.
           </para>
         </listitem>




More information about the sr-dev mailing list