[sr-dev] git:master:9ce0f4ae: ims_ipsec_pcscf: removed shadowing (sub-scope) variables

Daniel-Constantin Mierla miconda at gmail.com
Wed Jun 1 14:15:07 CEST 2022


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-06-01T14:10:10+02:00

ims_ipsec_pcscf: removed shadowing (sub-scope) variables

---

Modified: src/modules/ims_ipsec_pcscf/cmd.c

---

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

---

diff --git a/src/modules/ims_ipsec_pcscf/cmd.c b/src/modules/ims_ipsec_pcscf/cmd.c
index 35bcaa28fb..5aa208d334 100644
--- a/src/modules/ims_ipsec_pcscf/cmd.c
+++ b/src/modules/ims_ipsec_pcscf/cmd.c
@@ -838,6 +838,9 @@ int ipsec_forward(struct sip_msg *m, udomain_t *d, int _cflags)
 	ip_addr_t via_host;
 	struct sip_msg *req = NULL;
 	struct cell *t = NULL;
+	struct socket_info *client_sock = NULL;
+
+	LM_DBG("processing with flags: 0x%x\n", _cflags);
 
 	if(m->first_line.type == SIP_REPLY) {
 		// Get request from reply
@@ -915,8 +918,7 @@ int ipsec_forward(struct sip_msg *m, udomain_t *d, int _cflags)
 		dst_port = dst_proto == PROTO_TCP ? s->port_uc : s->port_us;
 
 		// Check send socket
-		struct socket_info *client_sock =
-				grep_sock_info(via_host.af == AF_INET ? &ipsec_listen_addr
+		client_sock = grep_sock_info(via_host.af == AF_INET ? &ipsec_listen_addr
 													  : &ipsec_listen_addr6,
 						src_port, dst_proto);
 		if(!client_sock) {
@@ -960,7 +962,7 @@ int ipsec_forward(struct sip_msg *m, udomain_t *d, int _cflags)
 	}
 
 	// Set send socket
-	struct socket_info *client_sock = grep_sock_info(
+	client_sock = grep_sock_info(
 			via_host.af == AF_INET ? &ipsec_listen_addr : &ipsec_listen_addr6,
 			src_port, dst_proto);
 	if(!client_sock) {
@@ -990,10 +992,12 @@ int ipsec_forward(struct sip_msg *m, udomain_t *d, int _cflags)
 
 	// Update dst_info in message
 	if(m->first_line.type == SIP_REPLY) {
-		struct cell *t = tmb.t_gett();
 		if(!t) {
-			LM_ERR("Error getting transaction\n");
-			goto cleanup;
+			t = tmb.t_gett();
+			if(!t) {
+				LM_ERR("Error getting transaction\n");
+				goto cleanup;
+			}
 		}
 		t->uas.response.dst = dst_info;
 	}




More information about the sr-dev mailing list