Skip to content

Commit

Permalink
sip/transp: add win32 local transport addr fallback (#1001)
Browse files Browse the repository at this point in the history
tcp_conn_local_get function does not always return information about the host address when the socket has been bound to an unspecified address.

fixes baresip/baresip#2797
  • Loading branch information
sreimers authored Nov 6, 2023
1 parent b6279bb commit b379bd7
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/sip/transp.c
Original file line number Diff line number Diff line change
Expand Up @@ -792,8 +792,22 @@ static int conn_send(struct sip_connqent **qentp, struct sip *sip, bool secure,
if (err)
goto out;

if (connh)
/* Fallback check for any address win32 */
if (!sa_isset(&conn->laddr, SA_ALL)) {
uint16_t port = sa_port(&conn->laddr);
err = sip_transp_laddr(sip, &conn->laddr, conn->tp, dst);
if (err)
goto out;

if (port)
sa_set_port(&conn->laddr, port);
}

if (connh) {
err = connh(&conn->laddr, dst, mb, arg);
if (err)
goto out;
}

(void)tcp_conn_settos(conn->tc, sip->tos);
#ifdef USE_TLS
Expand Down

0 comments on commit b379bd7

Please sign in to comment.