Skip to content

Commit 4457fb1

Browse files
Auto route correct
1 parent 072e522 commit 4457fb1

File tree

1 file changed

+37
-44
lines changed

1 file changed

+37
-44
lines changed

modules/topology_hiding/th_no_dlg_logic.c

Lines changed: 37 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -171,22 +171,17 @@ int topo_hiding_no_dlg(struct sip_msg *req, struct cell* t, unsigned int extra_f
171171

172172
p->flags = extra_flags;
173173

174-
if (req->REQ_METHOD != METHOD_ACK) {
175-
if (_th_no_dlg_onrequest(req, extra_flags, username) < 0) {
176-
LM_ERR("Failed to do topology_hiding on request\n");
177-
return -1;
178-
}
174+
if (_th_no_dlg_onrequest(req, extra_flags, username) < 0) {
175+
LM_ERR("Failed to do topology_hiding on request\n");
176+
return -1;
177+
}
179178

180-
if (tm_api.register_tmcb(req, 0, TMCB_RESPONSE_FWDED, th_no_dlg_onreply, p, shm_free_wrap) < 0) {
181-
LM_ERR("failed to register TMCB\n");
182-
return -1;
183-
}
179+
if (tm_api.register_tmcb(req, 0, TMCB_RESPONSE_FWDED, th_no_dlg_onreply, p, shm_free_wrap) < 0) {
180+
LM_ERR("failed to register TMCB\n");
181+
return -1;
182+
}
184183

185-
return 1;
186-
} else {
187-
LM_ERR("Failed to topology hide e2e ACK not supported\n");
188-
return TOPOH_MATCH_UNSUPPORTED_METHOD;
189-
}
184+
return 1;
190185
}
191186

192187
static int th_no_dlg_auto_route_seq_handling(struct sip_msg *msg, rr_t auto_route[static 1], str thinfo[static 1], int self_route) {
@@ -448,42 +443,40 @@ static void th_no_dlg_onreply(struct cell *t, int type, struct tmcb_params *para
448443
}
449444
}
450445

451-
if (one_way_hiding) {
452-
if (!is_sequential) {
453-
if (auto_route_on_trusted_socket) {
454-
rr_lmp = th_no_dlg_add_auto_record_route(rpl, flags);
455-
if (rr_lmp == NULL) {
456-
LM_ERR("Failed to add Record-Route header\n");
457-
pkg_free(suffix);
458-
return;
459-
}
460-
}
446+
if (one_way_hiding && !is_sequential) {
447+
if (auto_route_on_trusted_socket) {
448+
rr_lmp = th_no_dlg_add_auto_record_route(rpl, flags);
449+
if (rr_lmp == NULL) {
450+
LM_ERR("Failed to add Record-Route header\n");
451+
pkg_free(suffix);
452+
return;
453+
}
454+
}
461455

462-
if (rr_lmp == NULL) {
463-
rr_lmp = anchor_lump(rpl, rpl->headers->name.s - rpl->buf, HDR_RECORDROUTE_T);
464-
}
456+
if (rr_lmp == NULL) {
457+
rr_lmp = anchor_lump(rpl, rpl->headers->name.s - rpl->buf, HDR_RECORDROUTE_T);
458+
}
465459

466-
if ((req_rr_count = list_rr_body(req->record_route, &additional_rrs)) < 0 ){
467-
LM_ERR("failed to print route records \n");
468-
return;
469-
}
460+
if ((req_rr_count = list_rr_body(req->record_route, &additional_rrs)) < 0 ){
461+
LM_ERR("failed to print route records \n");
462+
return;
463+
}
470464

471-
for (int i = 0; i < req_rr_count; i++) {
472-
BUILD_RR_HEADER_BUFFER(req_rr_buf, req_rr_buf_len, additional_rrs[i]);
465+
for (int i = 0; i < req_rr_count; i++) {
466+
BUILD_RR_HEADER_BUFFER(req_rr_buf, req_rr_buf_len, additional_rrs[i]);
473467

474-
if (!req_rr_buf) {
475-
LM_ERR("no more pkg memory\n");
476-
return;
477-
}
468+
if (!req_rr_buf) {
469+
LM_ERR("no more pkg memory\n");
470+
return;
471+
}
478472

479-
if (!(rr_lmp = insert_new_lump_after(rr_lmp, req_rr_buf, req_rr_buf_len, 0))) {
480-
LM_ERR("failed to insert prefix\n");
481-
pkg_free(req_rr_buf);
482-
return;
483-
}
473+
if (!(rr_lmp = insert_new_lump_after(rr_lmp, req_rr_buf, req_rr_buf_len, 0))) {
474+
LM_ERR("failed to insert prefix\n");
475+
pkg_free(req_rr_buf);
476+
return;
484477
}
485-
}
486-
}
478+
}
479+
}
487480

488481
if (!one_way_hiding && !(rpl->REPLY_STATUS >= 300 && rpl->REPLY_STATUS < 400)) {
489482
if (th_no_dlg_encode_contact(rpl, flags, route_s, rr_count_to_skip_encode, username) < 0) {

0 commit comments

Comments
 (0)