[sr-dev] git:master:7a3a5443: lcr: remove excessive conditional check in do_from_gw()

Henning Westerholt hw at skalatan.de
Mon Sep 20 20:10:05 CEST 2021


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

Author: Donat Zenichev <dzenichev at sipwise.com>
Committer: Henning Westerholt <hw at skalatan.de>
Date: 2021-09-20T20:09:58+02:00

lcr: remove excessive conditional check in do_from_gw()

After an update of the bsearch(), which now supports matching not only
by the IP address, but also using the 'src_port', there is no need to check,
if the source port of a request matched the one from the 'lcr_gw'
('res' pointer will be NULL anyway, if ports don't match).

Nor do we need to check if it's zero.

---

Modified: src/modules/lcr/lcr_mod.c

---

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

---

diff --git a/src/modules/lcr/lcr_mod.c b/src/modules/lcr/lcr_mod.c
index 8c5b05d1df..23b5bce0dc 100644
--- a/src/modules/lcr/lcr_mod.c
+++ b/src/modules/lcr/lcr_mod.c
@@ -3035,8 +3035,7 @@ static int do_from_gw(struct sip_msg *_m, unsigned int lcr_id,
 
 	/* Store tag and flags and return result */
 	if((res != NULL)
-					&& ((transport == PROTO_NONE) || (res->transport_code == transport))
-					&& ((src_port == 0) || (res->port == src_port))) {
+					&& ((transport == PROTO_NONE) || (res->transport_code == transport))) {
 		LM_DBG("request came from gw\n");
 		if(tag_avp_param) {
 			val.s.s = res->tag;




More information about the sr-dev mailing list