diff options
author | Xin Long <lucien.xin@gmail.com> | 2017-12-08 16:04:03 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-12-11 19:23:04 +0300 |
commit | 9d4ceaf154a947e69648041bcb11a24a7a40c380 (patch) | |
tree | cafd57b388beae222ead30af268636082af7e237 /net/sctp/sm_statetable.c | |
parent | 668c9beb9020d5834ee9e43c208190a07d2b1928 (diff) | |
download | linux-9d4ceaf154a947e69648041bcb11a24a7a40c380.tar.xz |
sctp: implement validate_data for sctp_stream_interleave
validate_data is added as a member of sctp_stream_interleave, used
to validate ssn/chunk type for data or mid (message id)/chunk type
for idata, called in sctp_eat_data.
If this check fails, an abort packet will be sent, as said in
section 2.2.3 of RFC8260.
It also adds the process for idata in rx path. As Marcelo pointed
out, there's no need to add event table for idata, but just share
chunk_event_table with data's. It would drop data chunk for idata
and drop idata chunk for data by calling validate_data in
sctp_eat_data.
As last patch did, it also replaces sizeof(struct sctp_data_chunk)
with sctp_datachk_len for rx path.
After this patch, the idata can be accepted and delivered to ulp
layer.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/sm_statetable.c')
-rw-r--r-- | net/sctp/sm_statetable.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/sctp/sm_statetable.c b/net/sctp/sm_statetable.c index 79b6bee5b768..8c9bb4109f47 100644 --- a/net/sctp/sm_statetable.c +++ b/net/sctp/sm_statetable.c @@ -985,6 +985,9 @@ static const struct sctp_sm_table_entry *sctp_chunk_event_lookup( if (state > SCTP_STATE_MAX) return &bug; + if (net->sctp.intl_enable && cid == SCTP_CID_I_DATA) + cid = SCTP_CID_DATA; + if (cid <= SCTP_CID_BASE_MAX) return &chunk_event_table[cid][state]; |