summaryrefslogtreecommitdiffstats
path: root/src/vnet/udp
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/udp')
-rw-r--r--src/vnet/udp/udp.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c
index bf91c905eb6..d0c515a9d06 100644
--- a/src/vnet/udp/udp.c
+++ b/src/vnet/udp/udp.c
@@ -320,11 +320,13 @@ udp_session_get_half_open (u32 conn_index)
/* We don't poll main thread if we have workers */
thread_index = vlib_num_workers ()? 1 : 0;
uc = udp_connection_get (conn_index, thread_index);
+ if (!uc)
+ return 0;
return &uc->connection;
}
/* *INDENT-OFF* */
-const static transport_proto_vft_t udp_proto = {
+static const transport_proto_vft_t udp_proto = {
.start_listen = udp_session_bind,
.connect = udp_open_connection,
.stop_listen = udp_session_unbind,
@@ -339,8 +341,10 @@ const static transport_proto_vft_t udp_proto = {
.format_connection = format_udp_session,
.format_half_open = format_udp_half_open_session,
.format_listener = format_udp_listener_session,
- .tx_type = TRANSPORT_TX_DGRAM,
- .service_type = TRANSPORT_SERVICE_CL,
+ .transport_options = {
+ .tx_type = TRANSPORT_TX_DGRAM,
+ .service_type = TRANSPORT_SERVICE_CL,
+ },
};
/* *INDENT-ON* */
@@ -354,7 +358,8 @@ udpc_connection_open (transport_endpoint_cfg_t * rmt)
u32 uc_index;
uc_index = udp_open_connection (rmt);
uc = udp_connection_get (uc_index, thread_index);
- uc->is_connected = 1;
+ if (uc)
+ uc->is_connected = 1;
return uc_index;
}
@@ -370,7 +375,7 @@ udpc_connection_listen (u32 session_index, transport_endpoint_t * lcl)
}
/* *INDENT-OFF* */
-const static transport_proto_vft_t udpc_proto = {
+static const transport_proto_vft_t udpc_proto = {
.start_listen = udpc_connection_listen,
.stop_listen = udp_session_unbind,
.connect = udpc_connection_open,
@@ -385,8 +390,10 @@ const static transport_proto_vft_t udpc_proto = {
.format_connection = format_udp_session,
.format_half_open = format_udp_half_open_session,
.format_listener = format_udp_listener_session,
- .tx_type = TRANSPORT_TX_DGRAM,
- .service_type = TRANSPORT_SERVICE_CL,
+ .transport_options = {
+ .tx_type = TRANSPORT_TX_DGRAM,
+ .service_type = TRANSPORT_SERVICE_VC,
+ },
};
/* *INDENT-ON* */