Skip to content

Commit

Permalink
[tm] fix missing Route hdrs in locally generated ACK/CANCEL
Browse files Browse the repository at this point in the history
Even if those requests are hop-to-hop (and they do not need Route hdrs), this is valid only for stateful SIP servers. Yes, woow, we need to take care of stateless SIP server :P.
As various module may add lumps with Route hdrs, let's mark this, so we will know later if we should re-parse and check for such Route hdrs (in the outbound buffer)
Closes #3131

(cherry picked from commit 13bd2b8)
  • Loading branch information
bogdan-iancu committed Dec 8, 2023
1 parent 7c8b457 commit 8f6c1ea
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions modules/dialog/dlg_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -2719,6 +2719,7 @@ int fix_route_dialog(struct sip_msg *req,struct dlg_cell *dlg)
pkg_free(route);
return -1;
}
req->msg_flags |= FL_HAS_ROUTE_LUMP;

LM_DBG("Setting route header to <%s> \n",route);

Expand Down Expand Up @@ -2812,6 +2813,7 @@ int fix_route_dialog(struct sip_msg *req,struct dlg_cell *dlg)
return -1;
}
free_rr(&head);
req->msg_flags |= FL_HAS_ROUTE_LUMP;
}

if (lmp == NULL) {
Expand Down Expand Up @@ -2844,6 +2846,7 @@ int fix_route_dialog(struct sip_msg *req,struct dlg_cell *dlg)
pkg_free(remote_contact);
return -1;
}
req->msg_flags |= FL_HAS_ROUTE_LUMP;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions modules/tm/t_msgbuilder.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ char *build_local(struct cell *Trans,unsigned int branch,

/* copy'n'paste Route headers that were sent out */
if (is_local(Trans) || (!is_local(Trans) &&
( (req && req->route) || /* at least one route was received*/
(Trans->uac[branch].path_vec.len!=0))) ) /* path was forced */
/* if there was a ROUTE received or added */
( req && (req->route || req->msg_flags&FL_HAS_ROUTE_LUMP))) )
{
buf_hdrs = extract_parsed_hdrs(Trans->uac[branch].request.buffer.s,
Trans->uac[branch].request.buffer.len );
Expand Down
3 changes: 3 additions & 0 deletions modules/topology_hiding/topo_hiding_logic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1956,6 +1956,7 @@ static int topo_no_dlg_seq_handling(struct sip_msg *msg,str *info)
LM_ERR("failed inserting new route set\n");
goto err_free_route;
}
msg->msg_flags |= FL_HAS_ROUTE_LUMP;

LM_DBG("Setting route header to <%s> \n",route);
LM_DBG("setting dst_uri to <%.*s> \n",head->nameaddr.uri.len,
Expand Down Expand Up @@ -2017,6 +2018,7 @@ static int topo_no_dlg_seq_handling(struct sip_msg *msg,str *info)
LM_ERR("failed inserting new route set\n");
goto err_free_route;
}
msg->msg_flags |= FL_HAS_ROUTE_LUMP;
}

if (lmp == NULL) {
Expand Down Expand Up @@ -2049,6 +2051,7 @@ static int topo_no_dlg_seq_handling(struct sip_msg *msg,str *info)
pkg_free(remote_contact);
goto err_free_head;
}
msg->msg_flags |= FL_HAS_ROUTE_LUMP;
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions msg_translator.c
Original file line number Diff line number Diff line change
Expand Up @@ -2073,6 +2073,8 @@ static inline int insert_path_as_route(struct sip_msg* msg, str* path)
return -1;
}

msg->msg_flags |= FL_HAS_ROUTE_LUMP;

return 0;
}

Expand Down
2 changes: 2 additions & 0 deletions parser/msg_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ enum request_method {
#define FL_BODY_NO_SDP (1<<20) /* message does not have an SDP body */
#define FL_IS_LOCAL (1<<21) /* the message is a locally generated
* one, not received */
#define FL_HAS_ROUTE_LUMP (1<<22) /* the message had Route headers added
* as lumps */

/* define the # of unknown URI parameters to parse */
#define URI_MAX_U_PARAMS 10
Expand Down

0 comments on commit 8f6c1ea

Please sign in to comment.