[sr-dev] git:master: tm: new module parameter - dns_reuse_rcv_socket

Daniel-Constantin Mierla miconda at gmail.com
Sat Jun 15 22:10:53 CEST 2013


Module: sip-router
Branch: master
Commit: 30e26f22600c3f50f0ea556bf2872ef7b0807c6a
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=30e26f22600c3f50f0ea556bf2872ef7b0807c6a

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Sat Jun 15 19:08:38 2013 +0200

tm: new module parameter - dns_reuse_rcv_socket

- control reuse of the receive socket for additional branches added by
  dns failover
- if 1, the rcv socket is used, if not it depends on mhomed - when that
  is 0, the first socket is used, otherwise will be selected based on
  routing table
- default is 0
- therefore beware when setting this parameter and mhomed=1
- based on discussion for FS#313

---

 modules/tm/t_fwd.c |   12 +++++++++---
 modules/tm/tm.c    |    3 +++
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/modules/tm/t_fwd.c b/modules/tm/t_fwd.c
index e0b2642..55d45f4 100644
--- a/modules/tm/t_fwd.c
+++ b/modules/tm/t_fwd.c
@@ -127,6 +127,7 @@
 
 
 extern int tm_failure_exec_mode;
+extern int tm_dns_reuse_rcv_socket;
 
 static int goto_on_branch = 0, branch_route = 0;
 
@@ -1073,14 +1074,16 @@ int add_uac_dns_fallback(struct cell *t, struct sip_msg* msg,
 							&old_uac->path,
 							 (old_uac->request.dst.send_flags.f &
 								SND_F_FORCE_SOCKET)?
-									old_uac->request.dst.send_sock:0,
+									old_uac->request.dst.send_sock:
+									((tm_dns_reuse_rcv_socket)
+											?msg->rcv.bind_address:0),
 							old_uac->request.dst.send_flags,
 							old_uac->request.dst.proto,
 							old_uac->request.buffer,
 							old_uac->request.buffer_len,
 							&old_uac->instance, &old_uac->ruid,
 							&old_uac->location_ua);
-			}else
+			} else {
 				/* add_uac will use dns_h => next_hop will be ignored.
 				 * Unfortunately we can't reuse the old buffer, the branch id
 				 *  must be changed and the send_socket might be different =>
@@ -1088,11 +1091,14 @@ int add_uac_dns_fallback(struct cell *t, struct sip_msg* msg,
 				ret=add_uac(t,  msg, &old_uac->uri, 0, &old_uac->path, 0,
 							 (old_uac->request.dst.send_flags.f &
 								SND_F_FORCE_SOCKET)?
-									old_uac->request.dst.send_sock:0,
+									old_uac->request.dst.send_sock:
+									((tm_dns_reuse_rcv_socket)
+											?msg->rcv.bind_address:0),
 							old_uac->request.dst.send_flags,
 							old_uac->request.dst.proto, UAC_DNS_FAILOVER_F,
 							&old_uac->instance, &old_uac->ruid,
 							&old_uac->location_ua);
+			}
 
 			if (ret<0){
 				/* failed, delete the copied dns_h */
diff --git a/modules/tm/tm.c b/modules/tm/tm.c
index f7407d6..5b410c1 100644
--- a/modules/tm/tm.c
+++ b/modules/tm/tm.c
@@ -316,6 +316,8 @@ int tm_remap_503_500 = 1;
 
 int tm_failure_exec_mode = 0;
 
+int tm_dns_reuse_rcv_socket = 0;
+
 static rpc_export_t tm_rpc[];
 
 static int fixup_t_check_status(void** param, int param_no);
@@ -540,6 +542,7 @@ static param_export_t params[]={
 	{"faked_reply_prio",    PARAM_INT, &faked_reply_prio                     },
 	{"remap_503_500",       PARAM_INT, &tm_remap_503_500                     },
 	{"failure_exec_mode",   PARAM_INT, &tm_failure_exec_mode                 },
+	{"dns_reuse_rcv_socket",PARAM_INT, &tm_dns_reuse_rcv_socket              },
 #ifdef CANCEL_REASON_SUPPORT
 	{"local_cancel_reason", PARAM_INT, &default_tm_cfg.local_cancel_reason   },
 	{"e2e_cancel_reason",   PARAM_INT, &default_tm_cfg.e2e_cancel_reason     },




More information about the sr-dev mailing list