mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 04:11:08 +00:00
res_pjsip/config_transport: Load and run without OpenSSL.
ASTERISK-28933 Reported-by: Walter Doekes Change-Id: I65eac49e5b0a79261ea80e2b9b38a836886ed59f
This commit is contained in:
committed by
Friendly Automation
parent
277aa0ced6
commit
ddfb76a864
@@ -618,6 +618,7 @@ static int transport_apply(const struct ast_sorcery *sorcery, void *obj)
|
|||||||
res = pjsip_tcp_transport_start3(ast_sip_get_pjsip_endpoint(), &cfg,
|
res = pjsip_tcp_transport_start3(ast_sip_get_pjsip_endpoint(), &cfg,
|
||||||
&temp_state->state->factory);
|
&temp_state->state->factory);
|
||||||
}
|
}
|
||||||
|
#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0
|
||||||
} else if (transport->type == AST_TRANSPORT_TLS) {
|
} else if (transport->type == AST_TRANSPORT_TLS) {
|
||||||
static int option = 1;
|
static int option = 1;
|
||||||
|
|
||||||
@@ -648,6 +649,7 @@ static int transport_apply(const struct ast_sorcery *sorcery, void *obj)
|
|||||||
&temp_state->state->host, NULL, transport->async_operations,
|
&temp_state->state->host, NULL, transport->async_operations,
|
||||||
&temp_state->state->factory);
|
&temp_state->state->factory);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
} else if ((transport->type == AST_TRANSPORT_WS) || (transport->type == AST_TRANSPORT_WSS)) {
|
} else if ((transport->type == AST_TRANSPORT_WS) || (transport->type == AST_TRANSPORT_WSS)) {
|
||||||
if (transport->cos || transport->tos) {
|
if (transport->cos || transport->tos) {
|
||||||
ast_log(LOG_WARNING, "TOS and COS values ignored for websocket transport\n");
|
ast_log(LOG_WARNING, "TOS and COS values ignored for websocket transport\n");
|
||||||
@@ -978,6 +980,7 @@ static int tls_method_to_str(const void *obj, const intptr_t *args, char **buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Helper function which turns a cipher name into an identifier */
|
/*! \brief Helper function which turns a cipher name into an identifier */
|
||||||
|
#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0
|
||||||
static pj_ssl_cipher cipher_name_to_id(const char *name)
|
static pj_ssl_cipher cipher_name_to_id(const char *name)
|
||||||
{
|
{
|
||||||
pj_ssl_cipher ciphers[PJ_SSL_SOCK_MAX_CIPHERS];
|
pj_ssl_cipher ciphers[PJ_SSL_SOCK_MAX_CIPHERS];
|
||||||
@@ -997,6 +1000,7 @@ static pj_ssl_cipher cipher_name_to_id(const char *name)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \internal
|
* \internal
|
||||||
@@ -1008,6 +1012,7 @@ static pj_ssl_cipher cipher_name_to_id(const char *name)
|
|||||||
* \retval 0 on success.
|
* \retval 0 on success.
|
||||||
* \retval -1 on error.
|
* \retval -1 on error.
|
||||||
*/
|
*/
|
||||||
|
#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0
|
||||||
static int transport_cipher_add(struct ast_sip_transport_state *state, const char *name)
|
static int transport_cipher_add(struct ast_sip_transport_state *state, const char *name)
|
||||||
{
|
{
|
||||||
pj_ssl_cipher cipher;
|
pj_ssl_cipher cipher;
|
||||||
@@ -1038,8 +1043,10 @@ static int transport_cipher_add(struct ast_sip_transport_state *state, const cha
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*! \brief Custom handler for TLS cipher setting */
|
/*! \brief Custom handler for TLS cipher setting */
|
||||||
|
#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0
|
||||||
static int transport_tls_cipher_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
|
static int transport_tls_cipher_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
|
||||||
{
|
{
|
||||||
struct ast_sip_transport *transport = obj;
|
struct ast_sip_transport *transport = obj;
|
||||||
@@ -1066,7 +1073,9 @@ static int transport_tls_cipher_handler(const struct aco_option *opt, struct ast
|
|||||||
}
|
}
|
||||||
return res ? -1 : 0;
|
return res ? -1 : 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0
|
||||||
static void cipher_to_str(char **buf, const pj_ssl_cipher *ciphers, unsigned int cipher_num)
|
static void cipher_to_str(char **buf, const pj_ssl_cipher *ciphers, unsigned int cipher_num)
|
||||||
{
|
{
|
||||||
struct ast_str *str;
|
struct ast_str *str;
|
||||||
@@ -1088,7 +1097,9 @@ static void cipher_to_str(char **buf, const pj_ssl_cipher *ciphers, unsigned int
|
|||||||
*buf = ast_strdup(ast_str_buffer(str));
|
*buf = ast_strdup(ast_str_buffer(str));
|
||||||
ast_free(str);
|
ast_free(str);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0
|
||||||
static int transport_tls_cipher_to_str(const void *obj, const intptr_t *args, char **buf)
|
static int transport_tls_cipher_to_str(const void *obj, const intptr_t *args, char **buf)
|
||||||
{
|
{
|
||||||
const struct ast_sip_transport *transport = obj;
|
const struct ast_sip_transport *transport = obj;
|
||||||
@@ -1101,7 +1112,9 @@ static int transport_tls_cipher_to_str(const void *obj, const intptr_t *args, ch
|
|||||||
cipher_to_str(buf, state->ciphers, state->tls.ciphers_num);
|
cipher_to_str(buf, state->ciphers, state->tls.ciphers_num);
|
||||||
return *buf ? 0 : -1;
|
return *buf ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0
|
||||||
static char *handle_pjsip_list_ciphers(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
static char *handle_pjsip_list_ciphers(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||||
{
|
{
|
||||||
pj_ssl_cipher ciphers[PJ_SSL_SOCK_MAX_CIPHERS];
|
pj_ssl_cipher ciphers[PJ_SSL_SOCK_MAX_CIPHERS];
|
||||||
@@ -1132,6 +1145,7 @@ static char *handle_pjsip_list_ciphers(struct ast_cli_entry *e, int cmd, struct
|
|||||||
ast_free(buf);
|
ast_free(buf);
|
||||||
return CLI_SUCCESS;
|
return CLI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*! \brief Custom handler for localnet setting */
|
/*! \brief Custom handler for localnet setting */
|
||||||
static int transport_localnet_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
|
static int transport_localnet_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
|
||||||
@@ -1331,7 +1345,9 @@ static int cli_print_body(void *obj, void *arg, int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct ast_cli_entry cli_commands[] = {
|
static struct ast_cli_entry cli_commands[] = {
|
||||||
|
#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0
|
||||||
AST_CLI_DEFINE(handle_pjsip_list_ciphers, "List available OpenSSL cipher names"),
|
AST_CLI_DEFINE(handle_pjsip_list_ciphers, "List available OpenSSL cipher names"),
|
||||||
|
#endif
|
||||||
AST_CLI_DEFINE(ast_sip_cli_traverse_objects, "List PJSIP Transports",
|
AST_CLI_DEFINE(ast_sip_cli_traverse_objects, "List PJSIP Transports",
|
||||||
.command = "pjsip list transports",
|
.command = "pjsip list transports",
|
||||||
.usage = "Usage: pjsip list transports [ like <pattern> ]\n"
|
.usage = "Usage: pjsip list transports [ like <pattern> ]\n"
|
||||||
@@ -1433,7 +1449,9 @@ int ast_sip_initialize_sorcery_transport(void)
|
|||||||
ast_sorcery_object_field_register_custom(sorcery, "transport", "verify_client", "", transport_tls_bool_handler, verify_client_to_str, NULL, 0, 0);
|
ast_sorcery_object_field_register_custom(sorcery, "transport", "verify_client", "", transport_tls_bool_handler, verify_client_to_str, NULL, 0, 0);
|
||||||
ast_sorcery_object_field_register_custom(sorcery, "transport", "require_client_cert", "", transport_tls_bool_handler, require_client_cert_to_str, NULL, 0, 0);
|
ast_sorcery_object_field_register_custom(sorcery, "transport", "require_client_cert", "", transport_tls_bool_handler, require_client_cert_to_str, NULL, 0, 0);
|
||||||
ast_sorcery_object_field_register_custom(sorcery, "transport", "method", "", transport_tls_method_handler, tls_method_to_str, NULL, 0, 0);
|
ast_sorcery_object_field_register_custom(sorcery, "transport", "method", "", transport_tls_method_handler, tls_method_to_str, NULL, 0, 0);
|
||||||
|
#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0
|
||||||
ast_sorcery_object_field_register_custom(sorcery, "transport", "cipher", "", transport_tls_cipher_handler, transport_tls_cipher_to_str, NULL, 0, 0);
|
ast_sorcery_object_field_register_custom(sorcery, "transport", "cipher", "", transport_tls_cipher_handler, transport_tls_cipher_to_str, NULL, 0, 0);
|
||||||
|
#endif
|
||||||
ast_sorcery_object_field_register_custom(sorcery, "transport", "local_net", "", transport_localnet_handler, localnet_to_str, localnet_to_vl, 0, 0);
|
ast_sorcery_object_field_register_custom(sorcery, "transport", "local_net", "", transport_localnet_handler, localnet_to_str, localnet_to_vl, 0, 0);
|
||||||
ast_sorcery_object_field_register_custom(sorcery, "transport", "tos", "0", transport_tos_handler, tos_to_str, NULL, 0, 0);
|
ast_sorcery_object_field_register_custom(sorcery, "transport", "tos", "0", transport_tos_handler, tos_to_str, NULL, 0, 0);
|
||||||
ast_sorcery_object_field_register(sorcery, "transport", "cos", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_transport, cos));
|
ast_sorcery_object_field_register(sorcery, "transport", "cos", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_transport, cos));
|
||||||
|
Reference in New Issue
Block a user