aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/udp
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/udp')
-rw-r--r--src/vnet/udp/builtin_server.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/vnet/udp/builtin_server.c b/src/vnet/udp/builtin_server.c
index 8f8cb4040a8..29c33beba2e 100644
--- a/src/vnet/udp/builtin_server.c
+++ b/src/vnet/udp/builtin_server.c
@@ -23,6 +23,7 @@
/** per-worker built-in server copy buffers */
u8 **copy_buffers;
+static int app_index = ~0;
static int
builtin_session_create_callback (stream_session_t * s)
@@ -38,6 +39,21 @@ builtin_session_disconnect_callback (stream_session_t * s)
stream_session_disconnect (s);
}
+static void
+builtin_session_reset_callback (stream_session_t * s)
+{
+ clib_warning ("Reset session %U", format_stream_session, s, 2);
+ stream_session_cleanup (s);
+}
+
+static int
+builtin_session_connected_callback (u32 app_index, u32 api_context,
+ stream_session_t * s, u8 is_fail)
+{
+ clib_warning ("called...");
+ return -1;
+}
+
static int
builtin_server_rx_callback (stream_session_t * s)
{
@@ -84,8 +100,10 @@ builtin_server_rx_callback (stream_session_t * s)
/* *INDENT-OFF* */
static session_cb_vft_t builtin_server = {
.session_accept_callback = builtin_session_create_callback,
+ .session_connected_callback = builtin_session_connected_callback,
.session_disconnect_callback = builtin_session_disconnect_callback,
- .builtin_server_rx_callback = builtin_server_rx_callback
+ .builtin_server_rx_callback = builtin_server_rx_callback,
+ .session_reset_callback = builtin_session_reset_callback
};
/* *INDENT-ON* */
@@ -116,6 +134,8 @@ attach_builtin_uri_server ()
if (vnet_application_attach (a))
return -1;
+
+ app_index = a->app_index;
return 0;
}
@@ -131,7 +151,7 @@ bind_builtin_uri_server (u8 * uri)
memset (a, 0, sizeof (*a));
a->uri = (char *) uri;
- a->app_index = ~0; /* built-in server */
+ a->app_index = app_index;
rv = vnet_bind_uri (a);
@@ -143,7 +163,7 @@ unbind_builtin_uri_server (u8 * uri)
{
vnet_unbind_args_t _a, *a = &_a;
- a->app_index = ~0;
+ a->app_index = app_index;
a->uri = (char *) uri;
return vnet_unbind_uri (a);
@@ -182,6 +202,8 @@ builtin_uri_bind_command_fn (vlib_main_t * vm,
if (uri == 0)
return clib_error_return (0, "uri to bind not specified...");
+ vnet_session_enable_disable (vm, 1 /* turn on UDP, etc. */ );
+
rv = bind_builtin_uri_server (uri);
vec_free (uri);