sctp_main_t *tm = &sctp_main;
sctp_connection_t *listener;
void *iface_ip;
+ u32 mtu = 1460;
pool_get (tm->listener_pool, listener);
clib_memset (listener, 0, sizeof (*listener));
ip_copy (&listener->sub_conn[SCTP_PRIMARY_PATH_IDX].connection.lcl_ip,
&tep->ip, tep->is_ip4);
- u32 mtu = tep->is_ip4 ? vnet_sw_interface_get_mtu (vnet_get_main (),
- tep->sw_if_index,
- VNET_MTU_IP4) :
- vnet_sw_interface_get_mtu (vnet_get_main (), tep->sw_if_index,
- VNET_MTU_IP6);
+ if (tep->sw_if_index != ENDPOINT_INVALID_INDEX)
+ mtu = tep->is_ip4 ? vnet_sw_interface_get_mtu (vnet_get_main (),
+ tep->sw_if_index,
+ VNET_MTU_IP4) :
+ vnet_sw_interface_get_mtu (vnet_get_main (), tep->sw_if_index,
+ VNET_MTU_IP6);
+
listener->sub_conn[SCTP_PRIMARY_PATH_IDX].PMTU = mtu;
listener->sub_conn[SCTP_PRIMARY_PATH_IDX].connection.is_ip4 = tep->is_ip4;
listener->sub_conn[SCTP_PRIMARY_PATH_IDX].connection.proto =
u8 i;
for (i = 0; i < MAX_SCTP_CONNECTIONS; i++)
{
+ if (i > 0 && sctp_conn->sub_conn[i].state == SCTP_SUBCONN_STATE_DOWN)
+ continue;
if (sctp_conn->sub_conn[i].connection.is_ip4)
{
- s = format (s, "%U[#%d][%s] %U:%d->%U:%d",
- s,
+ s = format (s, "[#%d][%s] %U:%d->%U:%d",
sctp_conn->sub_conn[i].connection.thread_index,
- "T",
+ "S",
format_ip4_address,
&sctp_conn->sub_conn[i].connection.lcl_ip.ip4,
clib_net_to_host_u16 (sctp_conn->sub_conn[i].
}
else
{
- s = format (s, "%U[#%d][%s] %U:%d->%U:%d",
- s,
+ s = format (s, "[#%d][%s] %U:%d->%U:%d",
sctp_conn->sub_conn[i].connection.thread_index,
- "T",
+ "S",
format_ip6_address,
&sctp_conn->sub_conn[i].connection.lcl_ip.ip6,
clib_net_to_host_u16 (sctp_conn->sub_conn[i].
if (verbose)
{
s = format (s, "%-15U", format_sctp_state, sctp_conn->state);
+ if (verbose > 1)
+ s = format (s, "\n");
}
return s;
ip46_address_t lcl_addr;
u16 lcl_port;
uword thread_id;
+ u32 mtu = 1460;
int rv;
u8 idx = SCTP_PRIMARY_PATH_IDX;
clib_spinlock_lock_if_init (&tm->half_open_lock);
sctp_conn = sctp_half_open_connection_new (thread_id);
- u32 mtu = rmt->is_ip4 ? vnet_sw_interface_get_mtu (vnet_get_main (),
- rmt->peer.sw_if_index,
- VNET_MTU_IP4) :
- vnet_sw_interface_get_mtu (vnet_get_main (), rmt->peer.sw_if_index,
- VNET_MTU_IP6);
+ if (rmt->peer.sw_if_index != ENDPOINT_INVALID_INDEX)
+ mtu = rmt->is_ip4 ? vnet_sw_interface_get_mtu (vnet_get_main (),
+ rmt->peer.sw_if_index,
+ VNET_MTU_IP4) :
+ vnet_sw_interface_get_mtu (vnet_get_main (), rmt->peer.sw_if_index,
+ VNET_MTU_IP6);
sctp_conn->sub_conn[idx].PMTU = mtu;
transport_connection_t *trans_conn = &sctp_conn->sub_conn[idx].connection;
{
/* Start cleanup. App wasn't notified yet so use delete notify as
* opposed to delete to cleanup session layer state. */
- stream_session_delete_notify (&sctp_conn->sub_conn
- [SCTP_PRIMARY_PATH_IDX].connection);
+ session_transport_delete_notify (&sctp_conn->sub_conn
+ [SCTP_PRIMARY_PATH_IDX].connection);
sctp_connection_timers_reset (sctp_conn);
vec_validate (tm->ip_lookup_tx_frames[0], num_threads - 1);
vec_validate (tm->ip_lookup_tx_frames[1], num_threads - 1);
- tm->bytes_per_buffer = vlib_buffer_free_list_buffer_size
- (vm, VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX);
+ tm->bytes_per_buffer = vlib_buffer_get_default_data_size (vm);
vec_validate (tm->time_now, num_threads - 1);
return error;
sctp_flush_frames_to_output (thread_index);
}
-/* *INDENT OFF* */
-const static transport_proto_vft_t sctp_proto = {
+/* *INDENT-OFF* */
+static const transport_proto_vft_t sctp_proto = {
.enable = sctp_enable_disable,
- .bind = sctp_session_bind,
- .unbind = sctp_session_unbind,
- .open = sctp_session_open,
+ .start_listen = sctp_session_bind,
+ .stop_listen = sctp_session_unbind,
+ .connect = sctp_session_open,
.close = sctp_session_close,
.cleanup = sctp_session_cleanup,
.push_header = sctp_push_header,
.format_connection = format_sctp_session,
.format_listener = format_sctp_listener_session,
.format_half_open = format_sctp_half_open,
- .tx_type = TRANSPORT_TX_DEQUEUE,
- .service_type = TRANSPORT_SERVICE_VC,
+ .transport_options = {
+ .tx_type = TRANSPORT_TX_DEQUEUE,
+ .service_type = TRANSPORT_SERVICE_VC,
+ },
};
-
-/* *INDENT ON* */
+/* *INDENT-ON* */
clib_error_t *
sctp_init (vlib_main_t * vm)
sctp_main_t *tm = vnet_get_sctp_main ();
ip_main_t *im = &ip_main;
ip_protocol_info_t *pi;
+ vlib_node_t *node = vlib_get_node_by_name (vm, (u8 *) "sctp4-established");
+ tm->sctp4_established_phase_node_index = node->index;
+
+ node = vlib_get_node_by_name (vm, (u8 *) "sctp6-established");
+ tm->sctp6_established_phase_node_index = node->index;
+
/* Session layer, and by implication SCTP, are disabled by default */
tm->is_enabled = 0;