2017-12-08 20:04:01 +07:00
|
|
|
/* SCTP kernel implementation
|
|
|
|
* (C) Copyright Red Hat Inc. 2017
|
|
|
|
*
|
|
|
|
* These are definitions used by the stream schedulers, defined in RFC
|
|
|
|
* draft ndata (https://tools.ietf.org/html/draft-ietf-tsvwg-sctp-ndata-11)
|
|
|
|
*
|
|
|
|
* This SCTP implementation is free software;
|
|
|
|
* you can redistribute it and/or modify it under the terms of
|
|
|
|
* the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This SCTP implementation is distributed in the hope that it
|
|
|
|
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
|
|
* ************************
|
|
|
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
* See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with GNU CC; see the file COPYING. If not, see
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* Please send any bug reports or fixes you make to the
|
|
|
|
* email addresses:
|
|
|
|
* lksctp developers <linux-sctp@vger.kernel.org>
|
|
|
|
*
|
|
|
|
* Written or modified by:
|
|
|
|
* Xin Long <lucien.xin@gmail.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __sctp_stream_interleave_h__
|
|
|
|
#define __sctp_stream_interleave_h__
|
|
|
|
|
|
|
|
struct sctp_stream_interleave {
|
|
|
|
__u16 data_chunk_len;
|
sctp: implement validate_ftsn for sctp_stream_interleave
validate_ftsn is added as a member of sctp_stream_interleave, used to
validate ssn/chunk type for fwdtsn or mid (message id)/chunk type for
ifwdtsn, called in sctp_sf_eat_fwd_tsn, just as validate_data.
If this check fails, an abort packet will be sent, as said in section
2.3.1 of RFC8260.
As ifwdtsn and fwdtsn chunks have different length, it also defines
ftsn_chunk_len for sctp_stream_interleave to describe the chunk size.
Then it replaces all sizeof(struct sctp_fwdtsn_chunk) with
sctp_ftsnchk_len.
It also adds the process for ifwdtsn in rx path. As Marcelo pointed
out, there's no need to add event table for ifwdtsn, but just share
prsctp_chunk_event_table with fwdtsn's. It would drop fwdtsn chunk
for ifwdtsn and drop ifwdtsn chunk for fwdtsn by calling validate_ftsn
in sctp_sf_eat_fwd_tsn.
After this patch, the ifwdtsn can be accepted.
Note that this patch also removes the sctp.intl_enable check for
idata chunks in sctp_chunk_event_lookup, as it will do this check
in validate_data later.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo R. Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-14 23:41:27 +07:00
|
|
|
__u16 ftsn_chunk_len;
|
2017-12-08 20:04:01 +07:00
|
|
|
/* (I-)DATA process */
|
|
|
|
struct sctp_chunk *(*make_datafrag)(const struct sctp_association *asoc,
|
|
|
|
const struct sctp_sndrcvinfo *sinfo,
|
|
|
|
int len, __u8 flags, gfp_t gfp);
|
2017-12-08 20:04:02 +07:00
|
|
|
void (*assign_number)(struct sctp_chunk *chunk);
|
2017-12-08 20:04:03 +07:00
|
|
|
bool (*validate_data)(struct sctp_chunk *chunk);
|
2017-12-08 20:04:04 +07:00
|
|
|
int (*ulpevent_data)(struct sctp_ulpq *ulpq,
|
|
|
|
struct sctp_chunk *chunk, gfp_t gfp);
|
2017-12-08 20:04:05 +07:00
|
|
|
int (*enqueue_event)(struct sctp_ulpq *ulpq,
|
|
|
|
struct sctp_ulpevent *event);
|
2017-12-08 20:04:06 +07:00
|
|
|
void (*renege_events)(struct sctp_ulpq *ulpq,
|
|
|
|
struct sctp_chunk *chunk, gfp_t gfp);
|
2017-12-08 20:04:07 +07:00
|
|
|
void (*start_pd)(struct sctp_ulpq *ulpq, gfp_t gfp);
|
2017-12-08 20:04:08 +07:00
|
|
|
void (*abort_pd)(struct sctp_ulpq *ulpq, gfp_t gfp);
|
2017-12-14 23:41:26 +07:00
|
|
|
/* (I-)FORWARD-TSN process */
|
|
|
|
void (*generate_ftsn)(struct sctp_outq *q, __u32 ctsn);
|
sctp: implement validate_ftsn for sctp_stream_interleave
validate_ftsn is added as a member of sctp_stream_interleave, used to
validate ssn/chunk type for fwdtsn or mid (message id)/chunk type for
ifwdtsn, called in sctp_sf_eat_fwd_tsn, just as validate_data.
If this check fails, an abort packet will be sent, as said in section
2.3.1 of RFC8260.
As ifwdtsn and fwdtsn chunks have different length, it also defines
ftsn_chunk_len for sctp_stream_interleave to describe the chunk size.
Then it replaces all sizeof(struct sctp_fwdtsn_chunk) with
sctp_ftsnchk_len.
It also adds the process for ifwdtsn in rx path. As Marcelo pointed
out, there's no need to add event table for ifwdtsn, but just share
prsctp_chunk_event_table with fwdtsn's. It would drop fwdtsn chunk
for ifwdtsn and drop ifwdtsn chunk for fwdtsn by calling validate_ftsn
in sctp_sf_eat_fwd_tsn.
After this patch, the ifwdtsn can be accepted.
Note that this patch also removes the sctp.intl_enable check for
idata chunks in sctp_chunk_event_lookup, as it will do this check
in validate_data later.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo R. Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-14 23:41:27 +07:00
|
|
|
bool (*validate_ftsn)(struct sctp_chunk *chunk);
|
2017-12-14 23:41:28 +07:00
|
|
|
void (*report_ftsn)(struct sctp_ulpq *ulpq, __u32 ftsn);
|
2017-12-14 23:41:29 +07:00
|
|
|
void (*handle_ftsn)(struct sctp_ulpq *ulpq,
|
|
|
|
struct sctp_chunk *chunk);
|
2017-12-08 20:04:01 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
void sctp_stream_interleave_init(struct sctp_stream *stream);
|
|
|
|
|
|
|
|
#endif /* __sctp_stream_interleave_h__ */
|