Skip to content

Commit

Permalink
[tm] fix adding rport in local route
Browse files Browse the repository at this point in the history
Force the VIA rebuild if add_local_rport() (for adding rport param to VIA) was called from local route

Closes #2833
  • Loading branch information
bogdan-iancu committed Sep 14, 2022
1 parent 4062de4 commit c85d93c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions modules/tm/uac.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ static int run_local_route( struct cell *new_cell, char **buf, int *buf_len,
if (req->new_uri.s || req->force_send_socket!=dialog->send_sock ||
req->dst_uri.len != dialog->hooks.next_hop->len ||
memcmp(req->dst_uri.s,dialog->hooks.next_hop->s,req->dst_uri.len) ||
(dst_changed=0)!=0 || req->add_rm || should_update_sip_body(req)) {
(dst_changed=0)!=0 || req->add_rm || should_update_sip_body(req)
|| req->msg_flags&FL_FORCE_LOCAL_RPORT) {

/* stuff changed in the request, we may need to rebuild, so let's
* evaluate the changes first, mainly if the destination changed */
Expand Down Expand Up @@ -248,8 +249,14 @@ static int run_local_route( struct cell *new_cell, char **buf, int *buf_len,
}
}

/* if interface change, we need to re-build the via */
if (new_send_sock && new_send_sock != dialog->send_sock) {
/* if interface change or new VIA related flags were added,
* we need to re-build the via */
if ( (new_send_sock && new_send_sock != dialog->send_sock)
|| (req->msg_flags&FL_FORCE_LOCAL_RPORT &&
/* coding hack to get the new_send_sock set if FL_FORCE_LOCAL_RPORT
* was set (note that new_send_sock gets set only if destination was
* changed, which is not the case here) */
(new_send_sock=dialog->send_sock)!=NULL) ) {

LM_DBG("Interface change in local route -> "
"rebuilding via\n");
Expand Down

0 comments on commit c85d93c

Please sign in to comment.