u16 sctp_implied_length)
{
sctp_init_chunk_t *init_chunk = (sctp_init_chunk_t *) (sctp_hdr);
- ip4_address_t *ip4_addr = 0;
- ip6_address_t *ip6_addr = 0;
+ ip4_address_t ip4_addr;
+ ip6_address_t ip6_addr;
+ u8 add_ip4 = 0;
+ u8 add_ip6 = 0;
char hostname[FQDN_MAX_LENGTH];
/* Check the current state of the connection
SCTP_ADV_DBG ("Received INIT chunk while in COOKIE_WAIT state");
sctp_prepare_initack_chunk_for_collision (sctp_conn,
SCTP_PRIMARY_PATH_IDX,
- b0, ip4_addr, ip6_addr);
+ b0, &ip4_addr, &ip6_addr);
return SCTP_ERROR_NONE;
case SCTP_STATE_COOKIE_ECHOED:
case SCTP_STATE_SHUTDOWN_ACK_SENT:
if (sctp_conn->forming_association_changed == 0)
sctp_prepare_initack_chunk_for_collision (sctp_conn,
SCTP_PRIMARY_PATH_IDX,
- b0, ip4_addr, ip6_addr);
+ b0, &ip4_addr,
+ &ip6_addr);
else
sctp_prepare_abort_for_collision (sctp_conn,
SCTP_PRIMARY_PATH_IDX, b0,
- ip4_addr, ip6_addr);
+ &ip4_addr, &ip6_addr);
return SCTP_ERROR_NONE;
}
}
sctp_conn->remote_initial_tsn);
sctp_conn->peer_rwnd = clib_net_to_host_u32 (init_chunk->a_rwnd);
-
/*
* If the length specified in the INIT message is bigger than the size in bytes of our structure it means that
* optional parameters have been sent with the INIT chunk and we need to parse them.
{
sctp_ipv4_addr_param_t *ipv4 =
(sctp_ipv4_addr_param_t *) opt_params_hdr;
- clib_memcpy (ip4_addr, &ipv4->address,
+ clib_memcpy (&ip4_addr, &ipv4->address,
sizeof (ip4_address_t));
- sctp_sub_connection_add_ip4 (vlib_get_main (),
- &sctp_conn->sub_conn
- [SCTP_PRIMARY_PATH_IDX].connection.
- lcl_ip.ip4, &ipv4->address);
+ if (sctp_sub_connection_add_ip4 (vlib_get_main (),
+ &sctp_conn->sub_conn
+ [SCTP_PRIMARY_PATH_IDX].connection.
+ lcl_ip.ip4,
+ &ipv4->address) ==
+ SCTP_ERROR_NONE)
+ add_ip4 = 1;
break;
}
{
sctp_ipv6_addr_param_t *ipv6 =
(sctp_ipv6_addr_param_t *) opt_params_hdr;
- clib_memcpy (ip6_addr, &ipv6->address,
+ clib_memcpy (&ip6_addr, &ipv6->address,
sizeof (ip6_address_t));
- sctp_sub_connection_add_ip6 (vlib_get_main (),
- &sctp_conn->sub_conn
- [SCTP_PRIMARY_PATH_IDX].connection.
- lcl_ip.ip6, &ipv6->address);
+ if (sctp_sub_connection_add_ip6 (vlib_get_main (),
+ &sctp_conn->sub_conn
+ [SCTP_PRIMARY_PATH_IDX].connection.
+ lcl_ip.ip6,
+ &ipv6->address) ==
+ SCTP_ERROR_NONE)
+ add_ip6 = 1;
break;
}
}
/* Reuse buffer to make init-ack and send */
- sctp_prepare_initack_chunk (sctp_conn, SCTP_PRIMARY_PATH_IDX, b0, ip4_addr,
- ip6_addr);
+ sctp_prepare_initack_chunk (sctp_conn, SCTP_PRIMARY_PATH_IDX, b0, &ip4_addr,
+ add_ip4, &ip6_addr, add_ip6);
return SCTP_ERROR_NONE;
}
{
sctp_init_ack_chunk_t *init_ack_chunk =
(sctp_init_ack_chunk_t *) (sctp_hdr);
- sctp_state_cookie_param_t state_cookie;
char hostname[FQDN_MAX_LENGTH];
sctp_state_cookie_param_t *state_cookie_param =
(sctp_state_cookie_param_t *) opt_params_hdr;
- clib_memcpy (&state_cookie, state_cookie_param,
+ clib_memcpy (&(sctp_conn->cookie_param), state_cookie_param,
sizeof (sctp_state_cookie_param_t));
+
break;
}
case SCTP_HOSTNAME_ADDRESS_TYPE:
}
}
- clib_memcpy (&(sctp_conn->cookie_param), &state_cookie,
- sizeof (sctp_state_cookie_param_t));
-
sctp_prepare_cookie_echo_chunk (sctp_conn, idx, b0, 1);
/* Start the T1_COOKIE timer */
return 0;
}
- if (is_gapping != 0)
+ if (is_gapping)
{
SCTP_CONN_TRACKING_DBG
("gapping != 0: CONN_INDEX = %u, sctp_conn->ack_state = %u",
return 0;
}
+ sctp_conn->ack_state += 1;
if (sctp_conn->ack_state >= MAX_ENQUEABLE_SACKS)
{
SCTP_CONN_TRACKING_DBG
return 0;
}
- sctp_conn->ack_state += 1;
-
return 1;
}
}
sctp_conn->last_rcvd_tsn = tsn;
- *next0 = sctp_next_drop (sctp_conn->sub_conn[idx].c_is_ip4);
-
SCTP_ADV_DBG ("POINTER_WITH_DATA = %p", b->data);
if (!sctp_is_sack_delayable (sctp_conn, idx, is_gapping))
- sctp_prepare_sack_chunk (sctp_conn, idx, b);
+ {
+ *next0 = sctp_next_output (sctp_conn->sub_conn[idx].c_is_ip4);
+ sctp_prepare_sack_chunk (sctp_conn, idx, b);
+ }
+ else
+ *next0 = sctp_next_drop (sctp_conn->sub_conn[idx].c_is_ip4);
sctp_conn->sub_conn[idx].enqueue_state = error;
sctp_connection_t * sctp_conn, u8 idx,
vlib_buffer_t * b0, u16 * next0)
{
- u32 now = sctp_time_now ();
+ u64 now = sctp_time_now ();
sctp_cookie_echo_chunk_t *cookie_echo =
(sctp_cookie_echo_chunk_t *) sctp_hdr;
sctp_calculate_rto (sctp_conn, idx);
- u32 creation_time =
- clib_net_to_host_u32 (cookie_echo->cookie.creation_time);
- u32 cookie_lifespan =
+ u64 creation_time =
+ clib_net_to_host_u64 (cookie_echo->cookie.creation_time);
+ u64 cookie_lifespan =
clib_net_to_host_u32 (cookie_echo->cookie.cookie_lifespan);
+
if (now > creation_time + cookie_lifespan)
{
SCTP_DBG ("now (%u) > creation_time (%u) + cookie_lifespan (%u)",
sctp_connection_timers_init (new_sctp_conn);
+ sctp_init_cwnd (new_sctp_conn);
+
error0 =
sctp_handle_init_ack (sctp_hdr, sctp_chunk_hdr,
new_sctp_conn, idx, b0,
sctp_implied_length);
- sctp_init_cwnd (new_sctp_conn);
-
if (session_stream_connect_notify
(&new_sctp_conn->sub_conn[idx].connection, 0))
{
* hence we should never get to the "default" case below.
*/
default:
- error0 = SCTP_ERROR_UNKOWN_CHUNK;
+ error0 = SCTP_ERROR_UNKNOWN_CHUNK;
next0 = sctp_next_drop (is_ip4);
goto drop;
}
* hence we should never get to the "default" case below.
*/
default:
- error0 = SCTP_ERROR_UNKOWN_CHUNK;
+ error0 = SCTP_ERROR_UNKNOWN_CHUNK;
next0 = sctp_next_drop (is_ip4);
goto drop;
}
sctp_connection_t * sctp_conn, u8 idx, vlib_buffer_t * b0,
u16 * next0)
{
+
/* Check that the LOCALLY generated tag is being used by the REMOTE peer as the verification tag */
if (sctp_conn->local_tag != sack_chunk->sctp_hdr.verification_tag)
{
+ SCTP_ADV_DBG
+ ("sctp_conn->local_tag != sack_chunk->sctp_hdr.verification_tag");
+
+ *next0 = sctp_next_drop (sctp_conn->sub_conn[idx].c_is_ip4);
+
return SCTP_ERROR_INVALID_TAG;
}
+ sctp_conn->sub_conn[idx].state = SCTP_SUBCONN_SACK_RECEIVED;
+
sctp_conn->sub_conn[idx].last_seen = sctp_time_now ();
/* Section 7.2.2; point (2) */
child_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].PMTU =
sctp_listener->sub_conn[SCTP_PRIMARY_PATH_IDX].PMTU;
child_conn->state = SCTP_STATE_CLOSED;
+ child_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].connection.fib_index =
+ sctp_listener->sub_conn[SCTP_PRIMARY_PATH_IDX].
+ connection.fib_index;
if (is_ip4)
{
sctp_chunks_common_hdr_t *sctp_chunk_hdr = &full_hdr->common_hdr;
u8 chunk_type = vnet_sctp_get_chunk_type (sctp_chunk_hdr);
- if (chunk_type != INIT)
+ if (chunk_type != INIT && chunk_type != DATA
+ && chunk_type != OPERATION_ERROR)
{
SCTP_DBG
("conn_index = %u: chunk_type != INIT... chunk_type=%s",
child_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].
connection.c_index, sctp_chunk_to_string (chunk_type));
- error0 = SCTP_ERROR_UNKOWN_CHUNK;
+ error0 = SCTP_ERROR_UNKNOWN_CHUNK;
next0 = sctp_next_drop (is_ip4);
goto drop;
}
sctp_init_snd_vars (child_conn);
+ sctp_init_cwnd (child_conn);
+
error0 =
sctp_handle_init (sctp_hdr, sctp_chunk_hdr, child_conn, b0,
sctp_implied_length);
- sctp_init_cwnd (child_conn);
-
if (error0 == SCTP_ERROR_NONE)
{
if (stream_session_accept
* hence we should never get to the "default" case below.
*/
default:
- error0 = SCTP_ERROR_UNKOWN_CHUNK;
+ error0 = SCTP_ERROR_UNKNOWN_CHUNK;
next0 = sctp_next_drop (is_ip4);
goto done;
}
sctp_prepare_operation_error (sctp_conn, SCTP_PRIMARY_PATH_IDX,
b0, UNRECOGNIZED_CHUNK_TYPE);
- error0 = SCTP_ERROR_UNKOWN_CHUNK;
+ error0 = SCTP_ERROR_UNKNOWN_CHUNK;
next0 = sctp_next_output (is_ip4);
goto done;
}