+always_inline u16
+sctp_handle_operation_err (sctp_header_t * sctp_hdr,
+ sctp_connection_t * sctp_conn, u8 idx,
+ vlib_buffer_t * b, u16 * next0)
+{
+ sctp_operation_error_t *op_err = (sctp_operation_error_t *) sctp_hdr;
+
+ /* Check that the LOCALLY generated tag is being used by the REMOTE peer as the verification tag */
+ if (sctp_conn->local_tag != sctp_hdr->verification_tag)
+ {
+ return SCTP_ERROR_INVALID_TAG;
+ }
+
+ if (clib_net_to_host_u16 (op_err->err_causes[0].param_hdr.type) ==
+ STALE_COOKIE_ERROR)
+ {
+ if (sctp_conn->state != SCTP_STATE_COOKIE_ECHOED)
+ *next0 = sctp_next_drop (sctp_conn->sub_conn[idx].c_is_ip4);
+ else
+ {
+ sctp_connection_cleanup (sctp_conn);
+
+ stream_session_disconnect_notify (&sctp_conn->
+ sub_conn[idx].connection);
+ }
+ }
+
+ return SCTP_ERROR_NONE;
+}
+