|
|
|
@ -899,7 +899,7 @@ sctp_main_enable (vlib_main_t * vm)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
clib_error_t *
|
|
|
|
|
sctp_enable_disable (vlib_main_t * vm, u8 is_en)
|
|
|
|
|
sctp_transport_enable_disable (vlib_main_t * vm, u8 is_en)
|
|
|
|
|
{
|
|
|
|
|
if (is_en)
|
|
|
|
|
{
|
|
|
|
@ -942,7 +942,7 @@ sctp_update_time (f64 now, u8 thread_index)
|
|
|
|
|
|
|
|
|
|
/* *INDENT-OFF* */
|
|
|
|
|
static const transport_proto_vft_t sctp_proto = {
|
|
|
|
|
.enable = sctp_enable_disable,
|
|
|
|
|
.enable = sctp_transport_enable_disable,
|
|
|
|
|
.start_listen = sctp_session_bind,
|
|
|
|
|
.stop_listen = sctp_session_unbind,
|
|
|
|
|
.connect = sctp_session_open,
|
|
|
|
@ -966,32 +966,49 @@ static const transport_proto_vft_t sctp_proto = {
|
|
|
|
|
/* *INDENT-ON* */
|
|
|
|
|
|
|
|
|
|
clib_error_t *
|
|
|
|
|
sctp_init (vlib_main_t * vm)
|
|
|
|
|
sctp_enable_disable (vlib_main_t * vm, u8 is_en)
|
|
|
|
|
{
|
|
|
|
|
sctp_main_t *tm = vnet_get_sctp_main ();
|
|
|
|
|
sctp_main_t *sm = 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;
|
|
|
|
|
vlib_node_t *node;
|
|
|
|
|
|
|
|
|
|
node = vlib_get_node_by_name (vm, (u8 *) "sctp6-established");
|
|
|
|
|
tm->sctp6_established_phase_node_index = node->index;
|
|
|
|
|
if (!sm->is_init && is_en)
|
|
|
|
|
{
|
|
|
|
|
node = vlib_get_node_by_name (vm, (u8 *) "sctp4-established");
|
|
|
|
|
sm->sctp4_established_phase_node_index = node->index;
|
|
|
|
|
|
|
|
|
|
node = vlib_get_node_by_name (vm, (u8 *) "sctp6-established");
|
|
|
|
|
sm->sctp6_established_phase_node_index = node->index;
|
|
|
|
|
|
|
|
|
|
sm->is_init = 1;
|
|
|
|
|
|
|
|
|
|
/* Register with IP for header parsing */
|
|
|
|
|
pi = ip_get_protocol_info (im, IP_PROTOCOL_SCTP);
|
|
|
|
|
if (pi == 0)
|
|
|
|
|
return clib_error_return (0, "SCTP protocol info AWOL");
|
|
|
|
|
pi->format_header = format_sctp_header;
|
|
|
|
|
pi->unformat_pg_edit = unformat_pg_sctp_header;
|
|
|
|
|
|
|
|
|
|
/* Register as transport with session layer */
|
|
|
|
|
transport_register_protocol (TRANSPORT_PROTO_SCTP, &sctp_proto,
|
|
|
|
|
FIB_PROTOCOL_IP4, sctp4_output_node.index);
|
|
|
|
|
transport_register_protocol (TRANSPORT_PROTO_SCTP, &sctp_proto,
|
|
|
|
|
FIB_PROTOCOL_IP6, sctp6_output_node.index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sctp_transport_enable_disable (vm, is_en);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
clib_error_t *
|
|
|
|
|
sctp_init (vlib_main_t * vm)
|
|
|
|
|
{
|
|
|
|
|
sctp_main_t *sm = vnet_get_sctp_main ();
|
|
|
|
|
|
|
|
|
|
/* Session layer, and by implication SCTP, are disabled by default */
|
|
|
|
|
tm->is_enabled = 0;
|
|
|
|
|
|
|
|
|
|
/* Register with IP for header parsing */
|
|
|
|
|
pi = ip_get_protocol_info (im, IP_PROTOCOL_SCTP);
|
|
|
|
|
if (pi == 0)
|
|
|
|
|
return clib_error_return (0, "SCTP protocol info AWOL");
|
|
|
|
|
pi->format_header = format_sctp_header;
|
|
|
|
|
pi->unformat_pg_edit = unformat_pg_sctp_header;
|
|
|
|
|
|
|
|
|
|
/* Register as transport with session layer */
|
|
|
|
|
transport_register_protocol (TRANSPORT_PROTO_SCTP, &sctp_proto,
|
|
|
|
|
FIB_PROTOCOL_IP4, sctp4_output_node.index);
|
|
|
|
|
transport_register_protocol (TRANSPORT_PROTO_SCTP, &sctp_proto,
|
|
|
|
|
FIB_PROTOCOL_IP6, sctp6_output_node.index);
|
|
|
|
|
sm->is_enabled = 0;
|
|
|
|
|
sm->is_init = 0;
|
|
|
|
|
|
|
|
|
|
sctp_api_reference ();
|
|
|
|
|
|
|
|
|
@ -1023,6 +1040,46 @@ VLIB_CLI_COMMAND (show_tcp_punt_command, static) =
|
|
|
|
|
};
|
|
|
|
|
/* *INDENT-ON* */
|
|
|
|
|
|
|
|
|
|
static clib_error_t *
|
|
|
|
|
sctp_fn (vlib_main_t * vm, unformat_input_t * input,
|
|
|
|
|
vlib_cli_command_t * cmd_arg)
|
|
|
|
|
{
|
|
|
|
|
unformat_input_t _line_input, *line_input = &_line_input;
|
|
|
|
|
clib_error_t *error;
|
|
|
|
|
u8 is_en;
|
|
|
|
|
|
|
|
|
|
if (!unformat_user (input, unformat_line_input, line_input))
|
|
|
|
|
return clib_error_return (0, "expected enable | disable");
|
|
|
|
|
|
|
|
|
|
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
|
|
|
|
|
{
|
|
|
|
|
if (unformat (line_input, "enable"))
|
|
|
|
|
is_en = 1;
|
|
|
|
|
else if (unformat (line_input, "disable"))
|
|
|
|
|
is_en = 0;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
error = clib_error_return (0, "unknown input `%U'",
|
|
|
|
|
format_unformat_error, line_input);
|
|
|
|
|
unformat_free (line_input);
|
|
|
|
|
return error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unformat_free (line_input);
|
|
|
|
|
|
|
|
|
|
return sctp_enable_disable (vm, is_en);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* *INDENT-OFF* */
|
|
|
|
|
VLIB_CLI_COMMAND (show_sctp_command, static) =
|
|
|
|
|
{
|
|
|
|
|
.path = "sctp",
|
|
|
|
|
.short_help = "sctp [enable | disable]",
|
|
|
|
|
.function = sctp_fn,
|
|
|
|
|
};
|
|
|
|
|
/* *INDENT-ON* */
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* fd.io coding-style-patch-verification: ON
|
|
|
|
|
*
|
|
|
|
|