Skip to content

Commit

Permalink
Add a -trace option to quicserver to enable tracing of the communication
Browse files Browse the repository at this point in the history
Trace output of the communication with the client is dumped to stderr if
the -trace options is supplied

Reviewed-by: Tomas Mraz <[email protected]>
Reviewed-by: Hugo Landau <[email protected]>
(Merged from openssl#21800)
  • Loading branch information
mattcaswell committed Aug 24, 2023
1 parent cb93128 commit f430713
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions util/quicserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,14 @@ static BIO *create_dgram_bio(int family, const char *hostname, const char *port)

static void usage(void)
{
BIO_printf(bio_err, "quicserver [-6] hostname port certfile keyfile\n");
BIO_printf(bio_err, "quicserver [-6][-trace] hostname port certfile keyfile\n");
}

int main(int argc, char *argv[])
{
QUIC_TSERVER_ARGS tserver_args = {0};
QUIC_TSERVER *qtserv = NULL;
int ipv6 = 0;
int ipv6 = 0, trace = 0;
int argnext = 1;
BIO *bio = NULL;
char *hostname, *port, *certfile, *keyfile;
Expand All @@ -162,6 +162,8 @@ int main(int argc, char *argv[])
break;
if (strcmp(argv[argnext], "-6") == 0) {
ipv6 = 1;
} else if(strcmp(argv[argnext], "-trace") == 0) {
trace = 1;
} else {
BIO_printf(bio_err, "Unrecognised argument %s\n", argv[argnext]);
usage();
Expand Down Expand Up @@ -207,6 +209,9 @@ int main(int argc, char *argv[])
/* Ownership of the BIO is passed to qtserv */
bio = NULL;

if (trace)
ossl_quic_tserver_set_msg_callback(qtserv, SSL_trace, bio_err);

/* Read the request */
do {
if (first)
Expand Down

0 comments on commit f430713

Please sign in to comment.