Skip to content

dialog: fix the route set of the automatic PRACK - #4395

Open
thiagosouza84 wants to merge 1 commit into
OpenSIPS:masterfrom
thiagosouza84:dialog-auto-prack-route-set
Open

thiagosouza84 wants to merge 1 commit into
OpenSIPS:masterfrom
thiagosouza84:dialog-auto-prack-route-set

Conversation

@thiagosouza84

Copy link
Copy Markdown
Contributor

Fixes #4298.

build_prack_dialog_info() (modules/dialog/dlg_req_within.c) had two problems with the PRACK route set:

  1. It was printed from all the Record-Route headers of the reliable 18x (skip_rrs = 0), including the proxy's own. As a result, the PRACK was routed to the proxy itself. The 2xx path (push_reply_in_dialog()) skips from_rr_nb + added_rr.
  2. It was parsed with parse_rr_body(rr_set.s, ...) into td->route_set, whose rr_t entries point into rr_set.s. That buffer is pkg_free()d at the end of the function, before tm prints the request, so the Route went out corrupted (e.g. Route: 172.30.50.10.0.10;lr;did=...>).

The fix:

  • skips the RRs received with the INVITE plus the ones added on the reply's branch, as for the 2xx. This does not apply under topology hiding, where the 2xx path doesn't skip either;
  • gives td its own copy of the route set (duplicate_rr()), which free_tm_dlg() releases as before.

Tests: OpenSIPS/sipssert-opensips-tests#38 (dialog/21.prack-uac-auto-rr-in-18x, dialog/22.prack-uac-auto-rr-in-18x-downstream).

Local results (arm64 source builds):

master 6abfdcc this PR
dialog 01–18 PASS PASS
21 (only the proxy's RR in the 180, PRACK with no Route) FAIL PASS
22 (downstream proxy RR, PRACK with only that Route) FAIL (timeout) PASS
topology-hiding, record-route PASS PASS

build_prack_dialog_info() built the PRACK route set from all the
Record-Route headers of the reliable 18x, including the proxy's own, and
parsed it into td->route_set over a buffer freed before the request was
sent. The PRACK went out with a corrupted Route (e.g. "Route:
172.30.50.10.0.10;lr;did=...>") towards the proxy itself.

Skip the RRs received with the INVITE and the ones added by the proxy, as
push_reply_in_dialog() does for the 2xx, and give td its own copy of the
route set.

Fixes OpenSIPS#4298.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] dialog: auto-prack - PRACK built with a malformed Route when the reliable 18x carries the proxy's Record-Route

1 participant