aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarco Varlese <marco.varlese@suse.com>2018-03-05 15:12:29 +0100
committerDamjan Marion <dmarion.lists@gmail.com>2018-03-05 18:41:26 +0000
commitc7fe4f39bca709a9ca094ffd4465490fa780a576 (patch)
tree4b310511183637a02c4f92a81b2557aa547cdb06 /src
parent53da221b13225695516ec7469ca29d82bb10e594 (diff)
SCTP: API to configure some tunables
This patch adds the possibility to configure some behaviors of the SCTP stack based on some tunable parameters (mainly ON/OFF). For the time being, that is limited to the bundling option (multiplexing messages) and to delaying the SACK message. Change-Id: I696493e0309e47163c1e119c7d9f82f7d8ee6b87 Signed-off-by: Marco Varlese <marco.varlese@suse.com>
Diffstat (limited to 'src')
-rw-r--r--src/vnet/sctp/sctp.api7
-rw-r--r--src/vnet/sctp/sctp.c67
-rw-r--r--src/vnet/sctp/sctp.h34
-rw-r--r--src/vnet/sctp/sctp_api.c17
-rw-r--r--src/vnet/sctp/sctp_input.c72
-rw-r--r--src/vnet/sctp/sctp_output.c10
6 files changed, 129 insertions, 78 deletions
diff --git a/src/vnet/sctp/sctp.api b/src/vnet/sctp/sctp.api
index 6253c954d1c..fb228617216 100644
--- a/src/vnet/sctp/sctp.api
+++ b/src/vnet/sctp/sctp.api
@@ -41,4 +41,11 @@ autoreply define sctp_del_src_dst_connection {
u32 vrf_id;
u8 src_address[16];
u8 dst_address[16];
+ };
+
+autoreply define sctp_config {
+ u32 client_index;
+ u32 context;
+ u8 never_delay_sack;
+ u8 never_bundle;
}; \ No newline at end of file
diff --git a/src/vnet/sctp/sctp.c b/src/vnet/sctp/sctp.c
index 0e086a1f072..42cc2acae91 100644
--- a/src/vnet/sctp/sctp.c
+++ b/src/vnet/sctp/sctp.c
@@ -27,11 +27,11 @@ sctp_connection_bind (u32 session_index, transport_endpoint_t * tep)
pool_get (tm->listener_pool, listener);
memset (listener, 0, sizeof (*listener));
- listener->sub_conn[MAIN_SCTP_SUB_CONN_IDX].subconn_idx =
- MAIN_SCTP_SUB_CONN_IDX;
- listener->sub_conn[MAIN_SCTP_SUB_CONN_IDX].c_c_index =
+ listener->sub_conn[SCTP_PRIMARY_PATH_IDX].subconn_idx =
+ SCTP_PRIMARY_PATH_IDX;
+ listener->sub_conn[SCTP_PRIMARY_PATH_IDX].c_c_index =
listener - tm->listener_pool;
- listener->sub_conn[MAIN_SCTP_SUB_CONN_IDX].connection.lcl_port = tep->port;
+ listener->sub_conn[SCTP_PRIMARY_PATH_IDX].connection.lcl_port = tep->port;
/* If we are provided a sw_if_index, bind using one of its IPs */
if (ip_is_zero (&tep->ip, 1) && tep->sw_if_index != ENDPOINT_INVALID_INDEX)
@@ -40,22 +40,22 @@ sctp_connection_bind (u32 session_index, transport_endpoint_t * tep)
tep->is_ip4)))
ip_set (&tep->ip, iface_ip, tep->is_ip4);
}
- ip_copy (&listener->sub_conn[MAIN_SCTP_SUB_CONN_IDX].connection.lcl_ip,
+ ip_copy (&listener->sub_conn[SCTP_PRIMARY_PATH_IDX].connection.lcl_ip,
&tep->ip, tep->is_ip4);
- listener->sub_conn[MAIN_SCTP_SUB_CONN_IDX].PMTU =
+ listener->sub_conn[SCTP_PRIMARY_PATH_IDX].PMTU =
vnet_sw_interface_get_mtu (vnet_get_main (), tep->sw_if_index, VLIB_TX);
- listener->sub_conn[MAIN_SCTP_SUB_CONN_IDX].connection.is_ip4 = tep->is_ip4;
- listener->sub_conn[MAIN_SCTP_SUB_CONN_IDX].connection.proto =
+ listener->sub_conn[SCTP_PRIMARY_PATH_IDX].connection.is_ip4 = tep->is_ip4;
+ listener->sub_conn[SCTP_PRIMARY_PATH_IDX].connection.proto =
TRANSPORT_PROTO_SCTP;
- listener->sub_conn[MAIN_SCTP_SUB_CONN_IDX].c_s_index = session_index;
- listener->sub_conn[MAIN_SCTP_SUB_CONN_IDX].connection.fib_index =
+ listener->sub_conn[SCTP_PRIMARY_PATH_IDX].c_s_index = session_index;
+ listener->sub_conn[SCTP_PRIMARY_PATH_IDX].connection.fib_index =
tep->fib_index;
listener->state = SCTP_STATE_CLOSED;
sctp_connection_timers_init (listener);
- return listener->sub_conn[MAIN_SCTP_SUB_CONN_IDX].c_c_index;
+ return listener->sub_conn[SCTP_PRIMARY_PATH_IDX].c_c_index;
}
u32
@@ -275,7 +275,7 @@ sctp_sub_connection_add (u8 thread_index)
ASSERT (subconn_idx < MAX_SCTP_CONNECTIONS);
sctp_conn->sub_conn[subconn_idx].connection.c_index =
- sctp_conn->sub_conn[MAIN_SCTP_SUB_CONN_IDX].connection.c_index;
+ sctp_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].connection.c_index;
sctp_conn->sub_conn[subconn_idx].connection.thread_index = thread_index;
sctp_conn->sub_conn[subconn_idx].subconn_idx = subconn_idx;
@@ -398,6 +398,21 @@ sctp_sub_connection_del_ip6 (ip6_address_t * lcl_addr,
return SCTP_ERROR_NONE;
}
+u8
+sctp_configure (sctp_user_configuration_t config)
+{
+ sctp_main_t *sctp_main = vnet_get_sctp_main ();
+
+ u32 thread_idx = vlib_get_thread_index ();
+
+ sctp_main->connections[thread_idx]->conn_config.never_delay_sack =
+ config.never_delay_sack;
+ sctp_main->connections[thread_idx]->conn_config.never_bundle =
+ config.never_bundle;
+
+ return 0;
+}
+
sctp_connection_t *
sctp_connection_new (u8 thread_index)
{
@@ -406,11 +421,11 @@ sctp_connection_new (u8 thread_index)
pool_get (sctp_main->connections[thread_index], sctp_conn);
memset (sctp_conn, 0, sizeof (*sctp_conn));
- sctp_conn->sub_conn[MAIN_SCTP_SUB_CONN_IDX].subconn_idx =
- MAIN_SCTP_SUB_CONN_IDX;
- sctp_conn->sub_conn[MAIN_SCTP_SUB_CONN_IDX].c_c_index =
+ sctp_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].subconn_idx =
+ SCTP_PRIMARY_PATH_IDX;
+ sctp_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].c_c_index =
sctp_conn - sctp_main->connections[thread_index];
- sctp_conn->sub_conn[MAIN_SCTP_SUB_CONN_IDX].c_thread_index = thread_index;
+ sctp_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].c_thread_index = thread_index;
sctp_conn->local_tag = 0;
return sctp_conn;
@@ -424,10 +439,10 @@ sctp_half_open_connection_new (u8 thread_index)
ASSERT (vlib_get_thread_index () == 0);
pool_get (tm->half_open_connections, sctp_conn);
memset (sctp_conn, 0, sizeof (*sctp_conn));
- sctp_conn->sub_conn[MAIN_SCTP_SUB_CONN_IDX].c_c_index =
+ sctp_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].c_c_index =
sctp_conn - tm->half_open_connections;
- sctp_conn->sub_conn[MAIN_SCTP_SUB_CONN_IDX].subconn_idx =
- MAIN_SCTP_SUB_CONN_IDX;
+ sctp_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].subconn_idx =
+ SCTP_PRIMARY_PATH_IDX;
return sctp_conn;
}
@@ -441,7 +456,7 @@ sctp_connection_open (transport_endpoint_t * rmt)
uword thread_id;
int rv;
- u8 idx = MAIN_SCTP_SUB_CONN_IDX;
+ u8 idx = SCTP_PRIMARY_PATH_IDX;
/*
* Allocate local endpoint
@@ -507,7 +522,7 @@ sctp_connection_cleanup (sctp_connection_t * sctp_conn)
sctp_conn->sub_conn[i].connection.lcl_port);
int thread_index =
- sctp_conn->sub_conn[MAIN_SCTP_SUB_CONN_IDX].connection.thread_index;
+ sctp_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].connection.thread_index;
/* Make sure all timers are cleared */
sctp_connection_timers_reset (sctp_conn);
@@ -550,7 +565,7 @@ void
sctp_connection_close (sctp_connection_t * sctp_conn)
{
SCTP_DBG ("Closing connection %u...",
- sctp_conn->sub_conn[MAIN_SCTP_SUB_CONN_IDX].connection.c_index);
+ sctp_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].connection.c_index);
sctp_conn->state = SCTP_STATE_SHUTDOWN_PENDING;
@@ -630,7 +645,7 @@ sctp_session_get_transport (u32 conn_index, u32 thread_index)
sctp_connection_get (conn_index, thread_index);
if (PREDICT_TRUE (sctp_conn != NULL))
- return &sctp_conn->sub_conn[MAIN_SCTP_SUB_CONN_IDX].connection;
+ return &sctp_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].connection;
return NULL;
}
@@ -641,7 +656,7 @@ sctp_session_get_listener (u32 listener_index)
sctp_main_t *tm = vnet_get_sctp_main ();
sctp_connection_t *sctp_conn;
sctp_conn = pool_elt_at_index (tm->listener_pool, listener_index);
- return &sctp_conn->sub_conn[MAIN_SCTP_SUB_CONN_IDX].connection;
+ return &sctp_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].connection;
}
u8 *
@@ -703,7 +718,7 @@ sctp_expired_timers_cb (u32 conn_index, u32 timer_id)
/* 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
- [MAIN_SCTP_SUB_CONN_IDX].connection);
+ [SCTP_PRIMARY_PATH_IDX].connection);
sctp_connection_timers_reset (sctp_conn);
@@ -875,7 +890,7 @@ transport_connection_t *
sctp_half_open_session_get_transport (u32 conn_index)
{
sctp_connection_t *sctp_conn = sctp_half_open_connection_get (conn_index);
- return &sctp_conn->sub_conn[MAIN_SCTP_SUB_CONN_IDX].connection;
+ return &sctp_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].connection;
}
u8 *
diff --git a/src/vnet/sctp/sctp.h b/src/vnet/sctp/sctp.h
index 2c649c9538a..32d3ab96862 100644
--- a/src/vnet/sctp/sctp.h
+++ b/src/vnet/sctp/sctp.h
@@ -78,7 +78,7 @@ typedef enum _sctp_error
#define IS_U_BIT_SET(var) ((var) & (1<<2))
#define MAX_SCTP_CONNECTIONS 8
-#define MAIN_SCTP_SUB_CONN_IDX 0
+#define SCTP_PRIMARY_PATH_IDX 0
#if (VLIB_BUFFER_TRACE_TRAJECTORY)
#define sctp_trajectory_add_start(b, start) \
@@ -181,9 +181,17 @@ _bytes_swap (void *pv, size_t n)
*/
#define SUGGESTED_COOKIE_LIFE_SPAN_INCREMENT 1000
+typedef struct _sctp_user_configuration
+{
+ u8 never_delay_sack;
+ u8 never_bundle;
+
+} sctp_user_configuration_t;
+
typedef struct _sctp_connection
{
sctp_sub_connection_t sub_conn[MAX_SCTP_CONNECTIONS]; /**< Common transport data. First! */
+ sctp_user_configuration_t conn_config; /**< Allows tuning of some SCTP behaviors */
u8 state; /**< SCTP state as per sctp_state_t */
u16 flags; /**< Chunk flag (see sctp_chunks_common_hdr_t) */
@@ -265,6 +273,8 @@ u8
sctp_sub_connection_del_ip6 (ip6_address_t * lcl_addr,
ip6_address_t * rmt_addr);
+u8 sctp_configure (sctp_user_configuration_t config);
+
void sctp_connection_close (sctp_connection_t * sctp_conn);
void sctp_connection_cleanup (sctp_connection_t * sctp_conn);
void sctp_connection_del (sctp_connection_t * sctp_conn);
@@ -546,7 +556,7 @@ sctp_half_open_connection_get (u32 conn_index)
clib_spinlock_lock_if_init (&sctp_main.half_open_lock);
if (!pool_is_free_index (sctp_main.half_open_connections, conn_index))
tc = pool_elt_at_index (sctp_main.half_open_connections, conn_index);
- tc->sub_conn[MAIN_SCTP_SUB_CONN_IDX].subconn_idx = MAIN_SCTP_SUB_CONN_IDX;
+ tc->sub_conn[SCTP_PRIMARY_PATH_IDX].subconn_idx = SCTP_PRIMARY_PATH_IDX;
clib_spinlock_unlock_if_init (&sctp_main.half_open_lock);
return tc;
}
@@ -561,7 +571,7 @@ sctp_half_open_connection_del (sctp_connection_t * tc)
sctp_main_t *sctp_main = vnet_get_sctp_main ();
clib_spinlock_lock_if_init (&sctp_main->half_open_lock);
pool_put_index (sctp_main->half_open_connections,
- tc->sub_conn[MAIN_SCTP_SUB_CONN_IDX].c_c_index);
+ tc->sub_conn[SCTP_PRIMARY_PATH_IDX].c_c_index);
if (CLIB_DEBUG)
memset (tc, 0xFA, sizeof (*tc));
clib_spinlock_unlock_if_init (&sctp_main->half_open_lock);
@@ -617,10 +627,10 @@ always_inline int
sctp_half_open_connection_cleanup (sctp_connection_t * tc)
{
/* Make sure this is the owning thread */
- if (tc->sub_conn[MAIN_SCTP_SUB_CONN_IDX].c_thread_index !=
+ if (tc->sub_conn[SCTP_PRIMARY_PATH_IDX].c_thread_index !=
vlib_get_thread_index ())
return 1;
- sctp_timer_reset (tc, MAIN_SCTP_SUB_CONN_IDX, SCTP_TIMER_T1_INIT);
+ sctp_timer_reset (tc, SCTP_PRIMARY_PATH_IDX, SCTP_TIMER_T1_INIT);
sctp_half_open_connection_del (tc);
return 0;
}
@@ -750,8 +760,8 @@ sctp_connection_get (u32 conn_index, u32 thread_index)
always_inline u8
sctp_data_subconn_select (sctp_connection_t * sctp_conn)
{
- u32 sub = MAIN_SCTP_SUB_CONN_IDX;
- u8 i, cwnd = sctp_conn->sub_conn[MAIN_SCTP_SUB_CONN_IDX].cwnd;
+ u32 sub = SCTP_PRIMARY_PATH_IDX;
+ u8 i, cwnd = sctp_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].cwnd;
for (i = 1; i < MAX_SCTP_CONNECTIONS; i++)
{
if (sctp_conn->sub_conn[i].state == SCTP_SUBCONN_STATE_DOWN)
@@ -784,8 +794,8 @@ sctp_sub_conn_id_via_ip6h (sctp_connection_t * sctp_conn, ip6_header_t * ip6h)
return i;
}
clib_warning ("Did not find a sub-connection; defaulting to %u",
- MAIN_SCTP_SUB_CONN_IDX);
- return MAIN_SCTP_SUB_CONN_IDX;
+ SCTP_PRIMARY_PATH_IDX);
+ return SCTP_PRIMARY_PATH_IDX;
}
always_inline u8
@@ -802,8 +812,8 @@ sctp_sub_conn_id_via_ip4h (sctp_connection_t * sctp_conn, ip4_header_t * ip4h)
return i;
}
clib_warning ("Did not find a sub-connection; defaulting to %u",
- MAIN_SCTP_SUB_CONN_IDX);
- return MAIN_SCTP_SUB_CONN_IDX;
+ SCTP_PRIMARY_PATH_IDX);
+ return SCTP_PRIMARY_PATH_IDX;
}
/**
@@ -866,7 +876,7 @@ always_inline void
update_smallest_pmtu_idx (sctp_connection_t * sctp_conn)
{
u8 i;
- u8 smallest_pmtu_index = MAIN_SCTP_SUB_CONN_IDX;
+ u8 smallest_pmtu_index = SCTP_PRIMARY_PATH_IDX;
for (i = 1; i < MAX_SCTP_CONNECTIONS; i++)
{
diff --git a/src/vnet/sctp/sctp_api.c b/src/vnet/sctp/sctp_api.c
index 6aac77d2826..5f93040effc 100644
--- a/src/vnet/sctp/sctp_api.c
+++ b/src/vnet/sctp/sctp_api.c
@@ -42,7 +42,8 @@
#define foreach_sctp_api_msg \
_(SCTP_ADD_SRC_DST_CONNECTION, sctp_add_src_dst_connection) \
-_(SCTP_DEL_SRC_DST_CONNECTION, sctp_del_src_dst_connection)
+_(SCTP_DEL_SRC_DST_CONNECTION, sctp_del_src_dst_connection) \
+_(SCTP_CONFIG, sctp_config)
static void
vl_api_sctp_add_src_dst_connection_t_handler
@@ -81,6 +82,20 @@ static void
REPLY_MACRO (VL_API_SCTP_ADD_SRC_DST_CONNECTION_REPLY);
}
+static void
+vl_api_sctp_config_t_handler (vl_api_sctp_config_t * mp)
+{
+ sctp_user_configuration_t config;
+ vl_api_sctp_config_reply_t *rmp;
+ int rv;
+
+ config.never_delay_sack = mp->never_delay_sack;
+ config.never_bundle = mp->never_bundle;
+ rv = sctp_configure (config);
+
+ REPLY_MACRO (VL_API_SCTP_CONFIG_REPLY);
+}
+
#define vl_msg_name_crc_list
#include <vnet/sctp/sctp.api.h>
#undef vl_msg_name_crc_list
diff --git a/src/vnet/sctp/sctp_input.c b/src/vnet/sctp/sctp_input.c
index 70adc7c3e34..962534c1a6b 100644
--- a/src/vnet/sctp/sctp_input.c
+++ b/src/vnet/sctp/sctp_input.c
@@ -337,7 +337,7 @@ sctp_handle_init (sctp_header_t * sctp_hdr,
case SCTP_STATE_COOKIE_WAIT:
SCTP_ADV_DBG ("Received INIT chunk while in COOKIE_WAIT state");
sctp_prepare_initack_chunk_for_collision (sctp_conn,
- MAIN_SCTP_SUB_CONN_IDX,
+ SCTP_PRIMARY_PATH_IDX,
b0, ip4_addr, ip6_addr);
return SCTP_ERROR_NONE;
case SCTP_STATE_COOKIE_ECHOED:
@@ -345,11 +345,11 @@ sctp_handle_init (sctp_header_t * sctp_hdr,
SCTP_ADV_DBG ("Received INIT chunk while in COOKIE_ECHOED state");
if (sctp_conn->forming_association_changed == 0)
sctp_prepare_initack_chunk_for_collision (sctp_conn,
- MAIN_SCTP_SUB_CONN_IDX,
+ SCTP_PRIMARY_PATH_IDX,
b0, ip4_addr, ip6_addr);
else
sctp_prepare_abort_for_collision (sctp_conn,
- MAIN_SCTP_SUB_CONN_IDX, b0,
+ SCTP_PRIMARY_PATH_IDX, b0,
ip4_addr, ip6_addr);
return SCTP_ERROR_NONE;
}
@@ -401,7 +401,7 @@ sctp_handle_init (sctp_header_t * sctp_hdr,
sctp_sub_connection_add_ip4 (vlib_get_main (),
&sctp_conn->sub_conn
- [MAIN_SCTP_SUB_CONN_IDX].connection.
+ [SCTP_PRIMARY_PATH_IDX].connection.
lcl_ip.ip4, &ipv4->address);
break;
@@ -415,7 +415,7 @@ sctp_handle_init (sctp_header_t * sctp_hdr,
sctp_sub_connection_add_ip6 (vlib_get_main (),
&sctp_conn->sub_conn
- [MAIN_SCTP_SUB_CONN_IDX].connection.
+ [SCTP_PRIMARY_PATH_IDX].connection.
lcl_ip.ip6, &ipv6->address);
break;
@@ -447,7 +447,7 @@ sctp_handle_init (sctp_header_t * sctp_hdr,
}
/* Reuse buffer to make init-ack and send */
- sctp_prepare_initack_chunk (sctp_conn, MAIN_SCTP_SUB_CONN_IDX, b0, ip4_addr,
+ sctp_prepare_initack_chunk (sctp_conn, SCTP_PRIMARY_PATH_IDX, b0, ip4_addr,
ip6_addr);
return SCTP_ERROR_NONE;
}
@@ -539,7 +539,7 @@ sctp_handle_init_ack (sctp_header_t * sctp_hdr,
sctp_sub_connection_add_ip4 (vlib_get_main (),
&sctp_conn->sub_conn
- [MAIN_SCTP_SUB_CONN_IDX].connection.
+ [SCTP_PRIMARY_PATH_IDX].connection.
lcl_ip.ip4, &ipv4->address);
break;
@@ -551,7 +551,7 @@ sctp_handle_init_ack (sctp_header_t * sctp_hdr,
sctp_sub_connection_add_ip6 (vlib_get_main (),
&sctp_conn->sub_conn
- [MAIN_SCTP_SUB_CONN_IDX].connection.
+ [SCTP_PRIMARY_PATH_IDX].connection.
lcl_ip.ip6, &ipv6->address);
break;
@@ -711,6 +711,12 @@ sctp_session_enqueue_data (sctp_connection_t * sctp_conn, vlib_buffer_t * b,
always_inline u8
sctp_is_sack_delayable (sctp_connection_t * sctp_conn, u8 idx, u8 is_gapping)
{
+ if (sctp_conn->conn_config.never_delay_sack)
+ {
+ SCTP_CONN_TRACKING_DBG ("sctp_conn->conn_config.never_delay_sack = ON");
+ return 0;
+ }
+
/* Section 4.4 of the RFC4960 */
if (sctp_conn->state == SCTP_STATE_SHUTDOWN_SENT)
{
@@ -748,7 +754,7 @@ sctp_is_connection_gapping (sctp_connection_t * sctp_conn, u32 tsn,
{
SCTP_CONN_TRACKING_DBG
("GAPPING: CONN_INDEX = %u, sctp_conn->next_tsn_expected = %u, tsn = %u, diff = %u",
- sctp_conn->sub_conn[MAIN_SCTP_SUB_CONN_IDX].connection.c_index,
+ sctp_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].connection.c_index,
sctp_conn->next_tsn_expected, tsn,
sctp_conn->next_tsn_expected - tsn);
@@ -1221,8 +1227,7 @@ sctp_handle_shutdown_ack (sctp_header_t * sctp_hdr,
* - STOP T2_SHUTDOWN timer
* - SEND SHUTDOWN_COMPLETE chunk
*/
- sctp_timer_reset (sctp_conn, MAIN_SCTP_SUB_CONN_IDX,
- SCTP_TIMER_T2_SHUTDOWN);
+ sctp_timer_reset (sctp_conn, SCTP_PRIMARY_PATH_IDX, SCTP_TIMER_T2_SHUTDOWN);
sctp_send_shutdown_complete (sctp_conn, idx, b0);
@@ -1633,14 +1638,14 @@ sctp46_listen_process_inline (vlib_main_t * vm,
child_conn =
sctp_lookup_connection (sctp_listener->sub_conn
- [MAIN_SCTP_SUB_CONN_IDX].c_fib_index, b0,
+ [SCTP_PRIMARY_PATH_IDX].c_fib_index, b0,
my_thread_index, is_ip4);
if (PREDICT_FALSE (child_conn->state != SCTP_STATE_CLOSED))
{
SCTP_DBG
("conn_index = %u: child_conn->state != SCTP_STATE_CLOSED.... STATE=%s",
- child_conn->sub_conn[MAIN_SCTP_SUB_CONN_IDX].
+ child_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].
connection.c_index,
sctp_state_to_string (child_conn->state));
error0 = SCTP_ERROR_CREATE_EXISTS;
@@ -1649,33 +1654,33 @@ sctp46_listen_process_inline (vlib_main_t * vm,
/* Create child session and send SYN-ACK */
child_conn = sctp_connection_new (my_thread_index);
- child_conn->sub_conn[MAIN_SCTP_SUB_CONN_IDX].subconn_idx =
- MAIN_SCTP_SUB_CONN_IDX;
- child_conn->sub_conn[MAIN_SCTP_SUB_CONN_IDX].c_lcl_port =
+ child_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].subconn_idx =
+ SCTP_PRIMARY_PATH_IDX;
+ child_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].c_lcl_port =
sctp_hdr->dst_port;
- child_conn->sub_conn[MAIN_SCTP_SUB_CONN_IDX].c_rmt_port =
+ child_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].c_rmt_port =
sctp_hdr->src_port;
- child_conn->sub_conn[MAIN_SCTP_SUB_CONN_IDX].c_is_ip4 = is_ip4;
- child_conn->sub_conn[MAIN_SCTP_SUB_CONN_IDX].connection.proto =
- sctp_listener->sub_conn[MAIN_SCTP_SUB_CONN_IDX].connection.proto;
- child_conn->sub_conn[MAIN_SCTP_SUB_CONN_IDX].PMTU =
- sctp_listener->sub_conn[MAIN_SCTP_SUB_CONN_IDX].PMTU;
+ child_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].c_is_ip4 = is_ip4;
+ child_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].connection.proto =
+ sctp_listener->sub_conn[SCTP_PRIMARY_PATH_IDX].connection.proto;
+ child_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].PMTU =
+ sctp_listener->sub_conn[SCTP_PRIMARY_PATH_IDX].PMTU;
child_conn->state = SCTP_STATE_CLOSED;
if (is_ip4)
{
- child_conn->sub_conn[MAIN_SCTP_SUB_CONN_IDX].c_lcl_ip4.as_u32 =
+ child_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].c_lcl_ip4.as_u32 =
ip4_hdr->dst_address.as_u32;
- child_conn->sub_conn[MAIN_SCTP_SUB_CONN_IDX].c_rmt_ip4.as_u32 =
+ child_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].c_rmt_ip4.as_u32 =
ip4_hdr->src_address.as_u32;
}
else
{
clib_memcpy (&child_conn->
- sub_conn[MAIN_SCTP_SUB_CONN_IDX].c_lcl_ip6,
+ sub_conn[SCTP_PRIMARY_PATH_IDX].c_lcl_ip6,
&ip6_hdr->dst_address, sizeof (ip6_address_t));
clib_memcpy (&child_conn->
- sub_conn[MAIN_SCTP_SUB_CONN_IDX].c_rmt_ip6,
+ sub_conn[SCTP_PRIMARY_PATH_IDX].c_rmt_ip6,
&ip6_hdr->src_address, sizeof (ip6_address_t));
}
@@ -1687,7 +1692,7 @@ sctp46_listen_process_inline (vlib_main_t * vm,
{
SCTP_DBG
("conn_index = %u: chunk_type != INIT... chunk_type=%s",
- child_conn->sub_conn[MAIN_SCTP_SUB_CONN_IDX].
+ child_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].
connection.c_index, sctp_chunk_to_string (chunk_type));
error0 = SCTP_ERROR_UNKOWN_CHUNK;
@@ -1715,9 +1720,9 @@ sctp46_listen_process_inline (vlib_main_t * vm,
{
if (stream_session_accept
(&child_conn->
- sub_conn[MAIN_SCTP_SUB_CONN_IDX].connection,
+ sub_conn[SCTP_PRIMARY_PATH_IDX].connection,
sctp_listener->
- sub_conn[MAIN_SCTP_SUB_CONN_IDX].c_s_index, 0))
+ sub_conn[SCTP_PRIMARY_PATH_IDX].c_s_index, 0))
{
clib_warning ("session accept fail");
sctp_connection_cleanup (child_conn);
@@ -1738,8 +1743,7 @@ sctp46_listen_process_inline (vlib_main_t * vm,
case OPERATION_ERROR:
error0 =
sctp_handle_operation_err (sctp_hdr, child_conn,
- MAIN_SCTP_SUB_CONN_IDX, b0,
- &next0);
+ SCTP_PRIMARY_PATH_IDX, b0, &next0);
break;
}
@@ -2167,7 +2171,7 @@ sctp46_input_dispatcher (vlib_main_t * vm, vlib_node_runtime_t * node,
clib_warning
("Received an unrecognized chunk; sending back OPERATION_ERROR chunk");
- sctp_prepare_operation_error (sctp_conn, MAIN_SCTP_SUB_CONN_IDX,
+ sctp_prepare_operation_error (sctp_conn, SCTP_PRIMARY_PATH_IDX,
b0, UNRECOGNIZED_CHUNK_TYPE);
error0 = SCTP_ERROR_UNKOWN_CHUNK;
@@ -2192,9 +2196,9 @@ sctp46_input_dispatcher (vlib_main_t * vm, vlib_node_runtime_t * node,
SCTP_DBG_STATE_MACHINE
("S_INDEX = %u, C_INDEX = %u, TRANS_CONN = %p, SCTP_CONN = %p, CURRENT_CONNECTION_STATE = %s,"
"CHUNK_TYPE_RECEIVED = %s " "NEXT_PHASE = %s",
- sctp_conn->sub_conn[MAIN_SCTP_SUB_CONN_IDX].
+ sctp_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].
connection.s_index,
- sctp_conn->sub_conn[MAIN_SCTP_SUB_CONN_IDX].
+ sctp_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].
connection.c_index, trans_conn, sctp_conn,
sctp_state_to_string (sctp_conn->state),
sctp_chunk_to_string (chunk_type), phase_to_string (next0));
diff --git a/src/vnet/sctp/sctp_output.c b/src/vnet/sctp/sctp_output.c
index 41fa1b31709..a4ba960789e 100644
--- a/src/vnet/sctp/sctp_output.c
+++ b/src/vnet/sctp/sctp_output.c
@@ -605,7 +605,7 @@ sctp_send_cookie_echo (sctp_connection_t * sctp_conn)
clib_warning ("Reached MAX_INIT_RETRANS times. Aborting connection.");
session_stream_connect_notify (&sctp_conn->sub_conn
- [MAIN_SCTP_SUB_CONN_IDX].connection, 1);
+ [SCTP_PRIMARY_PATH_IDX].connection, 1);
sctp_connection_timers_reset (sctp_conn);
@@ -616,7 +616,7 @@ sctp_send_cookie_echo (sctp_connection_t * sctp_conn)
return;
b = vlib_get_buffer (vm, bi);
- u8 idx = MAIN_SCTP_SUB_CONN_IDX;
+ u8 idx = SCTP_PRIMARY_PATH_IDX;
sctp_init_buffer (vm, b);
sctp_prepare_cookie_echo_chunk (sctp_conn, idx, b, 0);
@@ -1056,7 +1056,7 @@ sctp_send_shutdown (sctp_connection_t * sctp_conn)
if (PREDICT_FALSE (sctp_get_free_buffer_index (tm, &bi)))
return;
- u8 idx = MAIN_SCTP_SUB_CONN_IDX;
+ u8 idx = SCTP_PRIMARY_PATH_IDX;
b = vlib_get_buffer (vm, bi);
sctp_init_buffer (vm, b);
@@ -1321,7 +1321,7 @@ sctp_send_init (sctp_connection_t * sctp_conn)
clib_warning ("Reached MAX_INIT_RETRANS times. Aborting connection.");
session_stream_connect_notify (&sctp_conn->sub_conn
- [MAIN_SCTP_SUB_CONN_IDX].connection, 1);
+ [SCTP_PRIMARY_PATH_IDX].connection, 1);
sctp_connection_timers_reset (sctp_conn);
@@ -1334,7 +1334,7 @@ sctp_send_init (sctp_connection_t * sctp_conn)
return;
b = vlib_get_buffer (vm, bi);
- u8 idx = MAIN_SCTP_SUB_CONN_IDX;
+ u8 idx = SCTP_PRIMARY_PATH_IDX;
sctp_init_buffer (vm, b);
sctp_prepare_init_chunk (sctp_conn, idx, b);