aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl/vcl_test_server.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vcl/vcl_test_server.c')
-rw-r--r--src/vcl/vcl_test_server.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/vcl/vcl_test_server.c b/src/vcl/vcl_test_server.c
index 54f164e43c1..280944156c8 100644
--- a/src/vcl/vcl_test_server.c
+++ b/src/vcl/vcl_test_server.c
@@ -320,7 +320,8 @@ print_usage_and_exit (void)
" -h Print this message and exit.\n"
" -6 Use IPv6\n"
" -w <num> Number of workers\n"
- " -u Use UDP transport layer\n");
+ " -D Use UDP transport layer\n"
+ " -S Use TLS transport layer\n");
exit (1);
}
@@ -370,7 +371,7 @@ vcl_test_server_process_opts (vcl_test_server_main_t * vsm, int argc,
vsm->cfg.proto = VPPCOM_PROTO_TCP;
opterr = 0;
- while ((c = getopt (argc, argv, "6Dsw:")) != -1)
+ while ((c = getopt (argc, argv, "6DSsw:")) != -1)
switch (c)
{
case '6':
@@ -381,6 +382,10 @@ vcl_test_server_process_opts (vcl_test_server_main_t * vsm, int argc,
vsm->cfg.proto = VPPCOM_PROTO_UDP;
break;
+ case 'S':
+ vsm->cfg.proto = VPPCOM_PROTO_TLS;
+ break;
+
case 'w':
v = atoi (optarg);
if (v > 1)
@@ -499,6 +504,15 @@ vts_worker_init (vcl_test_server_worker_t * wrk)
if (wrk->listen_fd < 0)
vtfail ("vppcom_session_create()", wrk->listen_fd);
+
+ if (vsm->cfg.proto == VPPCOM_PROTO_TLS)
+ {
+ vppcom_session_tls_add_cert (wrk->listen_fd, vcl_test_crt_rsa,
+ vcl_test_crt_rsa_len);
+ vppcom_session_tls_add_key (wrk->listen_fd, vcl_test_key_rsa,
+ vcl_test_key_rsa_len);
+ }
+
rv = vppcom_session_bind (wrk->listen_fd, &vsm->cfg.endpt);
if (rv < 0)
vtfail ("vppcom_session_bind()", rv);