Skip to content

Commit dcc20ac

Browse files
davidtrihy-genesysbenceszigeti
authored andcommitted
TELECOM-12357: One way topology hiding
1 parent 1661ede commit dcc20ac

File tree

8 files changed

+285
-138
lines changed

8 files changed

+285
-138
lines changed

modules/rr/rr_mod.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ static const cmd_export_t cmds[] = {
102102
{"record_route_preset", (cmd_function)w_record_route_preset, {
103103
{CMD_PARAM_STR, 0, 0},
104104
{CMD_PARAM_STR | CMD_PARAM_OPT ,0, 0}, {0,0,0}},
105-
REQUEST_ROUTE|BRANCH_ROUTE|FAILURE_ROUTE},
105+
REQUEST_ROUTE|BRANCH_ROUTE|FAILURE_ROUTE|ONREPLY_ROUTE},
106106
{"add_rr_param", (cmd_function)w_add_rr_param, {
107107
{CMD_PARAM_STR, 0, 0}, {0,0,0}},
108108
REQUEST_ROUTE|BRANCH_ROUTE|FAILURE_ROUTE},

modules/tm/t_hooks.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ void destroy_tmcb_lists(void)
8888
}
8989
}
9090

91+
static unsigned int tmcb_flags = 0;
92+
void set_tmcb_flags(unsigned int flags) {
93+
tmcb_flags |= flags;
94+
}
9195

9296
int insert_tmcb(struct tmcb_head_list *cb_list, int types,
9397
transaction_cb f, void *param, release_tmcb_param release_func )
@@ -109,6 +113,7 @@ int insert_tmcb(struct tmcb_head_list *cb_list, int types,
109113
cbp->param = param;
110114
cbp->release = release_func;
111115
cbp->types = types;
116+
cbp->flags = tmcb_flags;
112117
if (cbp->next)
113118
cbp->id = cbp->next->id+1;
114119
else
@@ -211,6 +216,7 @@ static void run_any_trans_callbacks(struct tmcb_head_list *list, unsigned int ty
211216
LM_DBG("trans=%p, callback type %d, id %d entered\n",
212217
trans, type, cbp->id );
213218
params.param = &(cbp->param);
219+
params.flags = cbp->flags;
214220
cbp->callback( trans, type, &params );
215221
if ((cbp->types)&(TMCB_REQUEST_IN|TMCB_LOCAL_TRANS_NEW)) {
216222
if (req && req->dst_uri.len==-1) {
@@ -224,6 +230,7 @@ static void run_any_trans_callbacks(struct tmcb_head_list *list, unsigned int ty
224230
/* env cleanup */
225231
set_avp_list( backup );
226232
tmcb_extra1 = tmcb_extra2 = 0;
233+
tmcb_flags = 0;
227234
set_t(trans_backup);
228235
}
229236

modules/tm/t_hooks.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ struct tmcb_params {
204204
struct sip_msg* req;
205205
struct sip_msg* rpl;
206206
int code;
207+
unsigned int flags;
207208
void **param;
208209
void *extra1;
209210
void *extra2;
@@ -216,14 +217,15 @@ typedef void (release_tmcb_param) (void *param);
216217
/* register callback function prototype */
217218
typedef int (*register_tmcb_f)(struct sip_msg* p_msg, struct cell *t,
218219
int cb_types, transaction_cb f, void *param, release_tmcb_param func);
219-
220+
typedef void (*set_tmcb_flags_f)(unsigned int flags);
220221

221222
struct tm_callback {
222223
int id; /* id of this callback - useless */
223224
int types; /* types of events that trigger the callback*/
224225
transaction_cb* callback; /* callback function */
225226
void *param; /* param to be passed to callback function */
226227
release_tmcb_param *release; /* function to release the callback param when the callback is deleted */
228+
unsigned int flags; /* flags to be passed into the callback*/
227229
struct tm_callback* next;
228230
};
229231

@@ -264,6 +266,9 @@ int insert_tmcb(struct tmcb_head_list *cb_list, int types,
264266
/* set extra params for callbacks */
265267
void set_extra_tmcb_params(void *extra1, void *extra2);
266268

269+
/* set extra params for callbacks */
270+
void set_tmcb_flags(unsigned int flags);
271+
267272
/* run all transaction callbacks for an event type */
268273
void run_trans_callbacks( int type , struct cell *trans,
269274
struct sip_msg *req, struct sip_msg *rpl, int code );

modules/tm/tm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,7 @@ static int fixup_inject_flags(void **param)
768768
int load_tm( struct tm_binds *tmb)
769769
{
770770
tmb->register_tmcb = register_tmcb;
771+
tmb->set_tmcb_flags = set_tmcb_flags;
771772

772773
/* relay function */
773774
tmb->t_relay = w_t_relay;

modules/tm/tm_load.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747

4848
struct tm_binds {
4949
register_tmcb_f register_tmcb;
50+
set_tmcb_flags_f set_tmcb_flags;
51+
5052
trelay_f t_relay;
5153
tcheck_trans_f t_check_trans;
5254

modules/topology_hiding/doc/topology_hiding_admin.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,26 @@ modparam("topology_hiding", "th_contact_callee_username_var", "__topo_hiding_use
256256
</example>
257257
</section>
258258

259+
<section id="param_th_internal_trusted_tag" xreflabel="th_internal_trusted_tag">
260+
<title><varname>th_internal_trusted_tag</varname> (string)</title>
261+
<para>
262+
Tag of one of the sockets in OpenSIPs to define if topology hiding should be applied to that socket
263+
</para>
264+
<para>
265+
<emphasis>
266+
Default value is <quote>empty</quote> - no tag
267+
</emphasis>
268+
</para>
269+
<example>
270+
<title>Set <varname>th_internal_trusted_tag</varname> parameter</title>
271+
<programlisting format="linespecific">
272+
...
273+
modparam("topology_hiding", "th_internal_trusted_tag", "TopoInternalTag")
274+
...
275+
</programlisting>
276+
</example>
277+
</section>
278+
259279
</section>
260280
<section id="exported_functions" xreflabel="exported_functions">
261281
<title>Exported Functions</title>

0 commit comments

Comments
 (0)