[sr-dev] git:master:1be693d4: nathelper: send always SIP ping if ping_nated_only=0 and sipping_flag is set

Daniel-Constantin Mierla miconda at gmail.com
Wed Jul 11 18:29:10 CEST 2018


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-07-11T18:27:08+02:00

nathelper: send always SIP ping if ping_nated_only=0 and sipping_flag is set

- reported by GH #1587

---

Modified: src/modules/nathelper/nathelper.c

---

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

---

diff --git a/src/modules/nathelper/nathelper.c b/src/modules/nathelper/nathelper.c
index 5382d4c6b8..b9d9d622b3 100644
--- a/src/modules/nathelper/nathelper.c
+++ b/src/modules/nathelper/nathelper.c
@@ -1921,7 +1921,7 @@ static void nh_timer(unsigned int ticks, void *timer_idx)
 	unsigned int path_ip = 0;
 	unsigned short path_port = 0;
 	int options = 0;
-	int should_send_ping = 0;
+	int send_sip_ping = 0;
 
 	if((*natping_state) == 0)
 		goto done;
@@ -2060,9 +2060,11 @@ static void nh_timer(unsigned int ticks, void *timer_idx)
 		dst.proto = PROTO_UDP;
 		dst.send_sock = send_sock;
 
-		should_send_ping = (flags & sipping_flag) != 0 || ping_nated_only == 0;
+		send_sip_ping = ((flags & sipping_flag) != 0)
+							|| (ping_nated_only == 0 && sipping_flag != 0);
 
-		if ( should_send_ping && (opt.s = build_sipping(&c, send_sock, &path, &ruid, aorhash, &opt.len)) != 0) {
+		if ( send_sip_ping && (opt.s = build_sipping(&c, send_sock, &path,
+						&ruid, aorhash, &opt.len)) != 0) {
 			if(udp_send(&dst, opt.s, opt.len) < 0) {
 				LM_ERR("sip udp_send failed\n");
 			}




More information about the sr-dev mailing list