Compare commits

...

4 Commits

Author SHA1 Message Date
yois615
02c0202ac2
Merge 4dab426ecff089ef9aa9430656e653fca5e8149f into 5e82e4f305dbf3760b6f6e3ba8fb70c3de30a6b9 2025-01-31 16:48:23 +00:00
Andrey Volk
5e82e4f305
Merge pull request #2755 from signalwire/eslleak
[esl] 1227669 Resource leak
2025-01-31 18:36:53 +03:00
Andrey Volk
d895fdff60 [esl] 1227669 Resource leak 2025-01-31 18:09:18 +03:00
Joseph Nadiv
4dab426ecf [mod_sofia] Rewrite rport even if endpoint specifies port in contact
If NDLB-force-rport is enabled, we rewrite the rport regardless
of what the endpoint thinks the port should be.  We do this by
checking the status of server_rport_level before writing the port.

Fixes #1457
2022-11-20 13:49:35 -05:00
2 changed files with 6 additions and 4 deletions

View File

@ -990,6 +990,8 @@ ESL_DECLARE(esl_status_t) esl_connect_timeout(esl_handle_t *handle, const char *
}
memcpy(&handle->sockaddr, result->ai_addr, result->ai_addrlen);
freeaddrinfo(result);
switch(handle->sockaddr.ss_family) {
case AF_INET:
sockaddr_in = (struct sockaddr_in*)&(handle->sockaddr);
@ -1005,7 +1007,6 @@ ESL_DECLARE(esl_status_t) esl_connect_timeout(esl_handle_t *handle, const char *
strncpy(handle->err, "Host resolves to unsupported address family", sizeof(handle->err));
goto fail;
}
freeaddrinfo(result);
handle->sock = socket(handle->sockaddr.ss_family, SOCK_STREAM, IPPROTO_TCP);

View File

@ -1543,7 +1543,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
exptime = 30;
}
if (port) {
if (port && profile->server_rport_level == 0) {
switch_snprintf(new_port, sizeof(new_port), ":%s", port);
}
@ -1659,11 +1659,12 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
}
if (!is_tcp && !is_tls && (zstr(network_ip) || !switch_check_network_list_ip(network_ip, profile->local_network)) &&
profile->server_rport_level >= 2 && sip->sip_user_agent &&
((profile->server_rport_level == 3 && sip->sip_user_agent &&
sip->sip_user_agent->g_string &&
( !strncasecmp(sip->sip_user_agent->g_string, "Poly", 4) ||
!strncasecmp(sip->sip_user_agent->g_string, "KIRK Wireless Server", 20) ||
!strncasecmp(sip->sip_user_agent->g_string, "ADTRAN_Total_Access", 19) )) {
!strncasecmp(sip->sip_user_agent->g_string, "ADTRAN_Total_Access", 19) ))
|| (profile->server_rport_level == 1 || profile->server_rport_level == 2))) {
if (sip->sip_via) {
const char *host = sip->sip_via->v_host;
const char *c_port = sip->sip_via->v_port;