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

Author: Lennart Rosam <ro...@sipgate.de>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2024-12-02T12:37:47+01:00

ims_scscf: Add more logging to ipsec_create()

Currently there are scenarios where ipsec_create() fails with no more
information in the logs. This should make debugging issues a bit easier.

Co-authored-by: Alexander Couzens <lyn...@fe80.eu>

---

Modified: src/modules/ims_ipsec_pcscf/cmd.c

---

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

---

diff --git a/src/modules/ims_ipsec_pcscf/cmd.c 
b/src/modules/ims_ipsec_pcscf/cmd.c
index 1f85cffc694..de261bfbb42 100644
--- a/src/modules/ims_ipsec_pcscf/cmd.c
+++ b/src/modules/ims_ipsec_pcscf/cmd.c
@@ -809,6 +809,7 @@ int ipsec_create(struct sip_msg *m, udomain_t *d, int 
_cflags)
        pcontact_t *pcontact = NULL;
        struct pcontact_info ci;
        int ret = IPSEC_CMD_FAIL; // FAIL by default
+       int fun_ret_c; // Used to store return codes of some functions
        tm_cell_t *t = NULL;
        sip_msg_t *req = NULL;
        security_t *req_sec_params = NULL;
@@ -893,10 +894,13 @@ int ipsec_create(struct sip_msg *m, udomain_t *d, int 
_cflags)
        }
 
        if(update_contact_ipsec_params(s, m, old_s) != 0) {
+               LM_ERR("Could not update ipsec params in contact.\n");
                goto cleanup;
        }
 
-       if(create_ipsec_tunnel(&req->rcv.src_ip, s) != 0) {
+       fun_ret_c = create_ipsec_tunnel(&req->rcv.src_ip, s);
+       if(fun_ret_c != 0) {
+               LM_ERR("IPSEC tunnel creation failed.\n");
                goto cleanup;
        }
 
@@ -917,11 +921,15 @@ int ipsec_create(struct sip_msg *m, udomain_t *d, int 
_cflags)
                goto cleanup;
        }
 
-       if(add_supported_secagree_header(m) != 0) {
+       fun_ret_c = add_supported_secagree_header(m);
+       if(fun_ret_c != 0) {
+               LM_ERR("Could not add secagree header. Failed with code: %d\n", 
fun_ret_c);
                goto cleanup;
        }
 
-       if(add_security_server_header(m, s) != 0) {
+       fun_ret_c = add_security_server_header(m, s);
+       if(fun_ret_c != 0) {
+               LM_ERR("Could not add security server header. Code: %d\n", 
fun_ret_c);
                goto cleanup;
        }
 

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to