Browse code

dispatcher: add state to mode in ds_list_exists

adds Bit 3 to allow the check of active/inactive entries in ds_list

lazedo authored on 31/10/2019 14:41:53
Showing 3 changed files
... ...
@@ -2998,7 +2998,9 @@ int ds_is_addr_from_set(sip_msg_t *_m, struct ip_addr *pipaddr,
2998 2998
 				&& ((mode & DS_MATCH_NOPORT) || node->dlist[j].port == 0
2999 2999
 						   || tport == node->dlist[j].port)
3000 3000
 				&& ((mode & DS_MATCH_NOPROTO)
3001
-						   || tproto == node->dlist[j].proto)) {
3001
+						   || tproto == node->dlist[j].proto)
3002
+				&& (((mode & DS_MATCH_ACTIVE) && !ds_skip_dst(node->dlist[j].flags))
3003
+						   || !(mode & DS_MATCH_ACTIVE))) {
3002 3004
 			if(export_set_pv && ds_setid_pvname.s != 0) {
3003 3005
 				memset(&val, 0, sizeof(pv_value_t));
3004 3006
 				val.flags = PV_VAL_INT | PV_TYPE_INT;
... ...
@@ -57,6 +57,7 @@
57 57
 #define DS_MATCH_ALL		0
58 58
 #define DS_MATCH_NOPORT		1
59 59
 #define DS_MATCH_NOPROTO	2
60
+#define DS_MATCH_ACTIVE 	4
60 61
 
61 62
 #define DS_SETOP_DSTURI		0
62 63
 #define DS_SETOP_RURI		1
... ...
@@ -1569,8 +1569,10 @@ if(ds_list_exists("10")) {
1569 1569
 		<listitem>
1570 1570
 			<para><emphasis>mode</emphasis> - (optional) - a bitmask to specify
1571 1571
 				how the matching should be done. If is 0, all ip, port and
1572
-				proto are matched. If bit one is set, then port is ignored.
1573
-				If bit two is set, then protocol is ignored. The parameter
1572
+				proto are matched and active status is ignored.
1573
+				If bit one is set, then port is ignored.
1574
+				If bit two is set, then protocol is ignored.
1575
+				If bit three is set, then state must be active.	The parameter
1574 1576
 				can be an integer or a variable holding an integer value.
1575 1577
 				It must be provided if the uri parameter is provided.
1576 1578
 			</para>