[sr-dev] git:master: - do not reactivate a gateway in probing mode, when it has been deactivated.

Carsten Bock carsten at bock.info
Mon Mar 7 21:32:35 CET 2011


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

Author: Carsten Bock <carsten at bock.info>
Committer: Carsten Bock <carsten at bock.info>
Date:   Mon Mar  7 21:24:03 2011 +0100

- do not reactivate a gateway in probing mode, when it has been deactivated.

---

 modules_k/dispatcher/dispatch.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/modules_k/dispatcher/dispatch.c b/modules_k/dispatcher/dispatch.c
index 36a362c..f957880 100644
--- a/modules_k/dispatcher/dispatch.c
+++ b/modules_k/dispatcher/dispatch.c
@@ -2039,7 +2039,6 @@ int ds_set_state(int group, str *address, int state, int type)
 				&& strncasecmp(idx->dlist[i].uri.s, address->s,
 					address->len)==0)
 		{
-			
 			/* remove the Probing/Inactive-State? Set the fail-count to 0. */
 			if (state == DS_PROBING_DST) {
 				if (type) {
@@ -2064,6 +2063,15 @@ int ds_set_state(int group, str *address, int state, int type)
 				idx->dlist[i].failure_count = 0;
 				state &= ~DS_RESET_FAIL_DST;
 			}
+	
+			/*  Type 2 means reply from OPTIONS-Ping */
+			if (type == 2) {
+				if (idx->dlist[i].flags & DS_INACTIVE_DST) {
+					LM_INFO("Ignoring the request to set this destination"
+							" to active: It is already administratively deactivated!\n");
+					return 0;
+				}
+			}
 			
 			if(type)
 				idx->dlist[i].flags |= state;
@@ -2307,7 +2315,7 @@ static void ds_options_callback( struct cell *t, int type,
 		/* Set the according entry back to "Active":
 		 *  remove the Probing/Inactive Flag and reset the failure counter. */
 		if (ds_set_state(group, &uri,
-					DS_INACTIVE_DST|DS_PROBING_DST|DS_RESET_FAIL_DST, 0) != 0)
+					DS_INACTIVE_DST|DS_PROBING_DST|DS_RESET_FAIL_DST, 2) != 0)
 		{
 			LM_ERR("Setting the state failed (%.*s, group %d)\n", uri.len,
 					uri.s, group);




More information about the sr-dev mailing list