aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/http_static
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-01-05 17:03:29 -0800
committerDave Barach <openvpp@barachs.net>2021-01-07 16:55:02 +0000
commita5a9efd4d1995ef6d46dfab4e5b8aba9c5d114ef (patch)
tree63db95ce5645cafed795284bd3138535f9605c65 /src/plugins/http_static
parente294de6f876587ddc34ab02771771aea60087adc (diff)
vcl session: switch to generic cert key apis
Remove the deprecated tls apis. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ia1e12bd813671146f0aca22e83d04c23ac13e595
Diffstat (limited to 'src/plugins/http_static')
-rw-r--r--src/plugins/http_static/http_static.h3
-rw-r--r--src/plugins/http_static/static_server.c37
2 files changed, 24 insertions, 16 deletions
diff --git a/src/plugins/http_static/http_static.h b/src/plugins/http_static/http_static.h
index daa2ecf9e89..8ee0f92cd44 100644
--- a/src/plugins/http_static/http_static.h
+++ b/src/plugins/http_static/http_static.h
@@ -181,6 +181,9 @@ typedef struct
/** Process node index for event scheduling */
u32 node_index;
+ /** Cert and key pair for tls */
+ u32 ckpair_index;
+
/** Session cleanup timer wheel */
tw_timer_wheel_2t_1w_2048sl_t tw;
clib_spinlock_t tw_lock;
diff --git a/src/plugins/http_static/static_server.c b/src/plugins/http_static/static_server.c
index 0ae67412016..b354666f816 100644
--- a/src/plugins/http_static/static_server.c
+++ b/src/plugins/http_static/static_server.c
@@ -1140,8 +1140,7 @@ static session_cb_vft_t http_static_server_session_cb_vft = {
static int
http_static_server_attach ()
{
- vnet_app_add_tls_cert_args_t _a_cert, *a_cert = &_a_cert;
- vnet_app_add_tls_key_args_t _a_key, *a_key = &_a_key;
+ vnet_app_add_cert_key_pair_args_t _ck_pair, *ck_pair = &_ck_pair;
http_static_server_main_t *hsm = &http_static_server_main;
u64 options[APP_OPTIONS_N_OPTIONS];
vnet_app_attach_args_t _a, *a = &_a;
@@ -1175,17 +1174,13 @@ http_static_server_attach ()
vec_free (a->name);
hsm->app_index = a->app_index;
- clib_memset (a_cert, 0, sizeof (*a_cert));
- a_cert->app_index = a->app_index;
- vec_validate (a_cert->cert, test_srv_crt_rsa_len);
- clib_memcpy_fast (a_cert->cert, test_srv_crt_rsa, test_srv_crt_rsa_len);
- vnet_app_add_tls_cert (a_cert);
-
- clib_memset (a_key, 0, sizeof (*a_key));
- a_key->app_index = a->app_index;
- vec_validate (a_key->key, test_srv_key_rsa_len);
- clib_memcpy_fast (a_key->key, test_srv_key_rsa, test_srv_key_rsa_len);
- vnet_app_add_tls_key (a_key);
+ clib_memset (ck_pair, 0, sizeof (*ck_pair));
+ ck_pair->cert = (u8 *) test_srv_crt_rsa;
+ ck_pair->key = (u8 *) test_srv_key_rsa;
+ ck_pair->cert_len = test_srv_crt_rsa_len;
+ ck_pair->key_len = test_srv_key_rsa_len;
+ vnet_app_add_cert_key_pair (ck_pair);
+ hsm->ckpair_index = ck_pair->index;
return 0;
}
@@ -1194,13 +1189,23 @@ static int
http_static_server_listen ()
{
http_static_server_main_t *hsm = &http_static_server_main;
+ session_endpoint_cfg_t sep = SESSION_ENDPOINT_CFG_NULL;
vnet_listen_args_t _a, *a = &_a;
+ char *uri = "tcp://0.0.0.0/80";
+
clib_memset (a, 0, sizeof (*a));
a->app_index = hsm->app_index;
- a->uri = "tcp://0.0.0.0/80";
+
if (hsm->uri)
- a->uri = (char *) hsm->uri;
- return vnet_bind_uri (a);
+ uri = (char *) hsm->uri;
+
+ if (parse_uri (uri, &sep))
+ return -1;
+
+ clib_memcpy (&a->sep_ext, &sep, sizeof (sep));
+ a->sep_ext.ckpair_index = hsm->ckpair_index;
+
+ return vnet_listen (a);
}
static void