aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/quic
diff options
context:
space:
mode:
authorMathiasRaoul <mathias.raoul@gmail.com>2019-09-26 09:17:13 +0000
committerAndrew Yourtchenko <ayourtch@gmail.com>2019-10-11 14:40:48 +0000
commit2f9ec50016e2b13c60aa2a979e5bae894a28363f (patch)
treecc3a62f7f6b43064bf2ca2e88665406dba6de179 /src/plugins/quic
parent291cd93ee0df6f8d6895cb2841aa7740ca42415e (diff)
quic: Create custom event logger
Type: feature Change-Id: I20acfe6a53cf9f15e3e4b8847b6f76757962f1c7 Signed-off-by: MathiasRaoul <mathias.raoul@gmail.com> (cherry picked from commit dd4d8ac29202fe54e74a13ce86d1ba3f79d1555f)
Diffstat (limited to 'src/plugins/quic')
-rw-r--r--src/plugins/quic/quic.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c
index 3d0da256fb6..4aaed1a4ec2 100644
--- a/src/plugins/quic/quic.c
+++ b/src/plugins/quic/quic.c
@@ -237,6 +237,43 @@ quic_increment_counter (u8 evt, u8 val)
vlib_node_increment_counter (vm, quic_input_node.index, evt, val);
}
+struct st_quic_event_log_t
+{
+ quicly_event_logger_t super;
+};
+
+void
+quic_event_log (quicly_event_logger_t * _self, quicly_event_type_t type,
+ const quicly_event_attribute_t * attributes,
+ size_t num_attributes)
+{
+ if (type == QUICLY_EVENT_TYPE_PACKET_LOST)
+ {
+ QUIC_DBG (1, "QUIC packet loss");
+ quic_increment_counter (QUIC_ERROR_PACKET_DROP, 1);
+ }
+}
+
+quicly_event_logger_t *
+quic_new_event_logger ()
+{
+ struct st_quic_event_log_t *self;
+
+ if ((self = clib_mem_alloc (sizeof (*self))) == NULL)
+ return NULL;
+ /* *INDENT-OFF* */
+ *self = (struct st_quic_event_log_t) {{quic_event_log}};
+ /* *INDENT-ON* */
+ return &self->super;
+}
+
+void
+quic_free_event_logger (quicly_event_logger_t * _self)
+{
+ struct st_quicly_default_event_log_t *self = (void *) _self;
+ clib_mem_free (self);
+}
+
/**
* Called when quicly return an error
* This function interacts tightly with quic_proto_on_close
@@ -935,8 +972,8 @@ quic_store_quicly_ctx (application_t * app, u8 is_client)
quicly_ctx->now = &quicly_vpp_now_cb;
quicly_amend_ptls_context (quicly_ctx->tls);
- quicly_ctx->event_log.mask = 0; /* logs */
- quicly_ctx->event_log.cb = quicly_new_default_event_logger (stderr);
+ quicly_ctx->event_log.mask = UINT64_MAX; /* logs */
+ quicly_ctx->event_log.cb = quic_new_event_logger ();
quicly_ctx->transport_params.max_data = QUIC_INT_MAX;
quicly_ctx->transport_params.max_streams_uni = (uint64_t) 1 << 60;