Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACK not sent using an existing TLS transport #3783

Merged
merged 1 commit into from
Nov 24, 2023
Merged

Conversation

nanangizz
Copy link
Member

@nanangizz nanangizz commented Nov 17, 2023

Scenario

  1. connect to a remote TLS server & send INVITE
  2. receive 100 & 180 responses
  3. TLS connection dropped (due to IP change), so remote initiates a new TLS connection from a different IP address
  4. receive 200 response
  5. send ACK will initiate another TLS connection instead of reusing the existing (established in step 3).

Analysis

The dialog will store the remote name in dlg->intial_dest in step 1 (see #3310) by dlg_update_routeset():

/* Update initial destination host from transport's info. */
if (rdata->tp_info.transport->dir == PJSIP_TP_DIR_OUTGOING)
{
pj_strdup(dlg->pool, &dlg->initial_dest,
&rdata->tp_info.transport->remote_name.host);
}

And in step 4, the remote name is supposed to be updated/reset by the same code above, but it does not happen as the transport used by 200 response is a server transport. So in sending the ACK in step 5, the transport manager won't find/reuse the transport created in step 3 because it is being requested for remote address in step 3 but with wrong/old remote name (set by step 1). Note that a TLS transport can be reused if it matches both: remote address and remote name (for TLS verification).

Resetting the dialog's remote name should be sufficient because later it will be initialized to the target address by pjsip_endpt_send_request_stateless() (or pjsip_endpt_send_response() if it is a response).

Thanks to Peter Koletzki for the report.

@PeterKoletzki
Copy link

We implement this patch and it solves the issue. Good catch.

@nanangizz
Copy link
Member Author

@PeterKoletzki Thanks for the confirmation.

@nanangizz nanangizz merged commit 04f8121 into master Nov 24, 2023
28 of 34 checks passed
@nanangizz nanangizz deleted the ack-not-reuse-tls-tp branch November 24, 2023 07:46
dshamaev-intermedia pushed a commit to intermedia-net/pjproject that referenced this pull request Apr 4, 2024
dshamaev-intermedia pushed a commit to intermedia-net/pjproject that referenced this pull request Apr 4, 2024
dshamaev-intermedia added a commit to intermedia-net/pjproject that referenced this pull request Apr 5, 2024
* Add option to shutdown all transports on IP change (pjsip#3781)

* pjsua_handle_ip_change: Added missing null check for on_ip_changed_progress callback (pjsip#3830)

* Reset stored remote name in dialog (dlg->initial_dest) if transport is server. (pjsip#3783)

* Prevent immediate tsx termination upon transport error (pjsip#3805)

* Fixed issues when adding new media and deinitializing media (pjsip#3821)

* Potential issues when IPv6 is disabled (pjsip#3835)

* Improve IP address change IPv4 <-> IPv6 (pjsip#3910)

* Add some missing unlocks (pjsip#3893)

* add missing unlock (pjsip#3885)

* Retransmit 2xx response when transport is closed (pjsip#3828)

* Fixed account's route set update when modifying account (pjsip#3825)

---------

Co-authored-by: Nanang Izzuddin <[email protected]>
Co-authored-by: sauwming <[email protected]>
Co-authored-by: Santiago De la Cruz <[email protected]>
Co-authored-by: Andreas Wehrmann <[email protected]>
Co-authored-by: Riza Sulistyo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants