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

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

ims_ipsec_pcscf: Add error logging

Currently the module initialization fails when the ipsec listen
interfaces cannot be bound and it does not produce a helpful log message
for the user. This commit addresses that.

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

---

Modified: src/modules/ims_ipsec_pcscf/ims_ipsec_pcscf_mod.c

---

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

---

diff --git a/src/modules/ims_ipsec_pcscf/ims_ipsec_pcscf_mod.c 
b/src/modules/ims_ipsec_pcscf/ims_ipsec_pcscf_mod.c
index 0c1097d55b3..9ff4a63755e 100644
--- a/src/modules/ims_ipsec_pcscf/ims_ipsec_pcscf_mod.c
+++ b/src/modules/ims_ipsec_pcscf/ims_ipsec_pcscf_mod.c
@@ -364,6 +364,7 @@ static int ipsec_add_listen_ifaces()
 static int mod_init(void)
 {
        bind_usrloc_t bind_usrloc;
+       int ret;
 
        bind_usrloc = (bind_usrloc_t)find_export("ul_bind_ims_usrloc_pcscf", 1, 
0);
        if(!bind_usrloc) {
@@ -371,7 +372,9 @@ static int mod_init(void)
                return -1;
        }
 
-       if(bind_usrloc(&ul) < 0) {
+       ret = bind_usrloc(&ul);
+       if(ret < 0) {
+               LM_ERR("bind_userloc() has failed with code %d", ret);
                return -1;
        }
        LM_INFO("Successfully bound to PCSCF Usrloc module\n");
@@ -383,7 +386,9 @@ static int mod_init(void)
        }
        LM_INFO("Successfully bound to TM module\n");
 
-       if(ipsec_add_listen_ifaces() != 0) {
+       ret = ipsec_add_listen_ifaces();
+       if(ret != 0) {
+               LM_ERR("Failed to add ipsec listen interface. Code: %d", ret);
                return -1;
        }
 

_______________________________________________
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