diff --git a/include/asterisk/tcptls.h b/include/asterisk/tcptls.h index 6fb6d4b63d..226e2ad598 100644 --- a/include/asterisk/tcptls.h +++ b/include/asterisk/tcptls.h @@ -114,7 +114,7 @@ struct ast_tls_config { */ struct ast_tcptls_session_args { struct sockaddr_in local_address; - struct sockaddr_in old_local_address; + struct sockaddr_in old_address; /*!< copy of the local or remote address depending on if its a client or server session */ struct sockaddr_in remote_address; char hostname[MAXHOSTNAMELEN]; /*!< only necessary for SSL clients so we can compare to common name */ struct ast_tls_config *tls_cfg; /*!< points to the SSL configuration if any */ diff --git a/main/http.c b/main/http.c index aa6ee7f94d..deb406165d 100644 --- a/main/http.c +++ b/main/http.c @@ -257,13 +257,13 @@ static struct ast_str *httpstatus_callback(struct ast_tcptls_session_instance *s "

  Asterisk™ HTTP Status

\r\n"); ast_str_append(&out, 0, "Prefix%s\r\n", prefix); ast_str_append(&out, 0, "Bind Address%s\r\n", - ast_inet_ntoa(http_desc.old_local_address.sin_addr)); + ast_inet_ntoa(http_desc.old_address.sin_addr)); ast_str_append(&out, 0, "Bind Port%d\r\n", - ntohs(http_desc.old_local_address.sin_port)); + ntohs(http_desc.old_address.sin_port)); if (http_tls_cfg.enabled) { ast_str_append(&out, 0, "SSL Bind Port%d\r\n", - ntohs(https_desc.old_local_address.sin_port)); + ntohs(https_desc.old_address.sin_port)); } ast_str_append(&out, 0, "
\r\n"); @@ -973,16 +973,16 @@ static char *handle_show_http(struct ast_cli_entry *e, int cmd, struct ast_cli_a } ast_cli(a->fd, "HTTP Server Status:\n"); ast_cli(a->fd, "Prefix: %s\n", prefix); - if (!http_desc.old_local_address.sin_family) { + if (!http_desc.old_address.sin_family) { ast_cli(a->fd, "Server Disabled\n\n"); } else { ast_cli(a->fd, "Server Enabled and Bound to %s:%d\n\n", - ast_inet_ntoa(http_desc.old_local_address.sin_addr), - ntohs(http_desc.old_local_address.sin_port)); + ast_inet_ntoa(http_desc.old_address.sin_addr), + ntohs(http_desc.old_address.sin_port)); if (http_tls_cfg.enabled) { ast_cli(a->fd, "HTTPS Server Enabled and Bound to %s:%d\n\n", - ast_inet_ntoa(https_desc.old_local_address.sin_addr), - ntohs(https_desc.old_local_address.sin_port)); + ast_inet_ntoa(https_desc.old_address.sin_addr), + ntohs(https_desc.old_address.sin_port)); } } diff --git a/main/tcptls.c b/main/tcptls.c index b6c20e2070..d0d8f6c030 100644 --- a/main/tcptls.c +++ b/main/tcptls.c @@ -334,12 +334,12 @@ struct ast_tcptls_session_instance *ast_tcptls_client_start(struct ast_tcptls_se struct ast_tcptls_session_instance *tcptls_session = NULL; /* Do nothing if nothing has changed */ - if(!memcmp(&desc->old_local_address, &desc->local_address, sizeof(desc->old_local_address))) { + if (!memcmp(&desc->old_address, &desc->remote_address, sizeof(desc->old_address))) { ast_debug(1, "Nothing changed in %s\n", desc->name); return NULL; } - desc->old_local_address = desc->local_address; + desc->old_address = desc->remote_address; if (desc->accept_fd != -1) close(desc->accept_fd); @@ -417,12 +417,12 @@ void ast_tcptls_server_start(struct ast_tcptls_session_args *desc) int x = 1; /* Do nothing if nothing has changed */ - if (!memcmp(&desc->old_local_address, &desc->local_address, sizeof(desc->old_local_address))) { + if (!memcmp(&desc->old_address, &desc->local_address, sizeof(desc->old_address))) { ast_debug(1, "Nothing changed in %s\n", desc->name); return; } - desc->old_local_address = desc->local_address; + desc->old_address = desc->local_address; /* Shutdown a running server if there is one */ if (desc->master != AST_PTHREADT_NULL) {