<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/15117">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip/config_transport: Load and run without OpenSSL.<br><br>ASTERISK-28933<br>Reported-by: Walter Doekes<br><br>Change-Id: I65eac49e5b0a79261ea80e2b9b38a836886ed59f<br>---<br>M res/res_pjsip/config_transport.c<br>1 file changed, 18 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_pjsip/config_transport.c b/res/res_pjsip/config_transport.c</span><br><span>index ac2405b..0cf118e 100644</span><br><span>--- a/res/res_pjsip/config_transport.c</span><br><span>+++ b/res/res_pjsip/config_transport.c</span><br><span>@@ -799,6 +799,7 @@</span><br><span> res = pjsip_tcp_transport_start3(ast_sip_get_pjsip_endpoint(), &cfg,</span><br><span> &temp_state->state->factory);</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0</span><br><span> } else if (transport->type == AST_TRANSPORT_TLS) {</span><br><span> static int option = 1;</span><br><span> </span><br><span>@@ -829,6 +830,7 @@</span><br><span> &temp_state->state->host, NULL, transport->async_operations,</span><br><span> &temp_state->state->factory);</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span> } else if ((transport->type == AST_TRANSPORT_WS) || (transport->type == AST_TRANSPORT_WSS)) {</span><br><span> if (transport->cos || transport->tos) {</span><br><span> ast_log(LOG_WARNING, "TOS and COS values ignored for websocket transport\n");</span><br><span>@@ -1166,6 +1168,7 @@</span><br><span> }</span><br><span> </span><br><span> /*! \brief Helper function which turns a cipher name into an identifier */</span><br><span style="color: hsl(120, 100%, 40%);">+#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0</span><br><span> static pj_ssl_cipher cipher_name_to_id(const char *name)</span><br><span> {</span><br><span> pj_ssl_cipher ciphers[PJ_SSL_SOCK_MAX_CIPHERS];</span><br><span>@@ -1185,6 +1188,7 @@</span><br><span> </span><br><span> return 0;</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span> </span><br><span> /*!</span><br><span> * \internal</span><br><span>@@ -1196,6 +1200,7 @@</span><br><span> * \retval 0 on success.</span><br><span> * \retval -1 on error.</span><br><span> */</span><br><span style="color: hsl(120, 100%, 40%);">+#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0</span><br><span> static int transport_cipher_add(struct ast_sip_transport_state *state, const char *name)</span><br><span> {</span><br><span> pj_ssl_cipher cipher;</span><br><span>@@ -1226,8 +1231,10 @@</span><br><span> return -1;</span><br><span> }</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span> </span><br><span> /*! \brief Custom handler for TLS cipher setting */</span><br><span style="color: hsl(120, 100%, 40%);">+#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0</span><br><span> static int transport_tls_cipher_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)</span><br><span> {</span><br><span> struct ast_sip_transport *transport = obj;</span><br><span>@@ -1254,7 +1261,9 @@</span><br><span> }</span><br><span> return res ? -1 : 0;</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0</span><br><span> static void cipher_to_str(char **buf, const pj_ssl_cipher *ciphers, unsigned int cipher_num)</span><br><span> {</span><br><span> struct ast_str *str;</span><br><span>@@ -1276,7 +1285,9 @@</span><br><span> *buf = ast_strdup(ast_str_buffer(str));</span><br><span> ast_free(str);</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0</span><br><span> static int transport_tls_cipher_to_str(const void *obj, const intptr_t *args, char **buf)</span><br><span> {</span><br><span> const struct ast_sip_transport *transport = obj;</span><br><span>@@ -1289,7 +1300,9 @@</span><br><span> cipher_to_str(buf, state->ciphers, state->tls.ciphers_num);</span><br><span> return *buf ? 0 : -1;</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0</span><br><span> static char *handle_pjsip_list_ciphers(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)</span><br><span> {</span><br><span> pj_ssl_cipher ciphers[PJ_SSL_SOCK_MAX_CIPHERS];</span><br><span>@@ -1320,6 +1333,7 @@</span><br><span> ast_free(buf);</span><br><span> return CLI_SUCCESS;</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span> </span><br><span> /*! \brief Custom handler for localnet setting */</span><br><span> static int transport_localnet_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)</span><br><span>@@ -1519,7 +1533,9 @@</span><br><span> }</span><br><span> </span><br><span> static struct ast_cli_entry cli_commands[] = {</span><br><span style="color: hsl(120, 100%, 40%);">+#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0</span><br><span> AST_CLI_DEFINE(handle_pjsip_list_ciphers, "List available OpenSSL cipher names"),</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span> AST_CLI_DEFINE(ast_sip_cli_traverse_objects, "List PJSIP Transports",</span><br><span> .command = "pjsip list transports",</span><br><span> .usage = "Usage: pjsip list transports [ like <pattern> ]\n"</span><br><span>@@ -1631,7 +1647,9 @@</span><br><span> ast_sorcery_object_field_register_custom(sorcery, "transport", "verify_client", "", transport_tls_bool_handler, verify_client_to_str, NULL, 0, 0);</span><br><span> ast_sorcery_object_field_register_custom(sorcery, "transport", "require_client_cert", "", transport_tls_bool_handler, require_client_cert_to_str, NULL, 0, 0);</span><br><span> ast_sorcery_object_field_register_custom(sorcery, "transport", "method", "", transport_tls_method_handler, tls_method_to_str, NULL, 0, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0</span><br><span> ast_sorcery_object_field_register_custom(sorcery, "transport", "cipher", "", transport_tls_cipher_handler, transport_tls_cipher_to_str, NULL, 0, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span> ast_sorcery_object_field_register_custom(sorcery, "transport", "local_net", "", transport_localnet_handler, localnet_to_str, localnet_to_vl, 0, 0);</span><br><span> ast_sorcery_object_field_register_custom(sorcery, "transport", "tos", "0", transport_tos_handler, tos_to_str, NULL, 0, 0);</span><br><span> ast_sorcery_object_field_register(sorcery, "transport", "cos", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_transport, cos));</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/15117">change 15117</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/15117"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 18 </div>
<div style="display:none"> Gerrit-Change-Id: I65eac49e5b0a79261ea80e2b9b38a836886ed59f </div>
<div style="display:none"> Gerrit-Change-Number: 15117 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Alexander Traud <pabstraud@compuserve.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>