diff options
author | Xin Long <lucien.xin@gmail.com> | 2017-12-08 08:03:59 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-12-11 11:23:04 -0500 |
commit | 96b120b3c1397c90b64d1f4b2300fb7ce4aa8a68 (patch) | |
tree | 8adff0f3c66c683e739a519a1b5d7cdc05cd65a7 | |
parent | 772a58693fc3116d05b7969223a80a6376e639eb (diff) |
sctp: add asoc intl_enable negotiation during 4 shakehands
asoc intl_enable will be set when local sp strm_interleave is set
and there's I-DATA chunk in init and init_ack extensions, as said
in section 2.2.1 of RFC8260.
asoc intl_enable indicates all data will be sent as I-DATA chunks.
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>
-rw-r--r-- | include/linux/sctp.h | 3 | ||||
-rw-r--r-- | net/sctp/sm_make_chunk.c | 18 |
2 files changed, 19 insertions, 2 deletions
diff --git a/include/linux/sctp.h b/include/linux/sctp.h index da803dfc7a39..6d2bd64b6ffe 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h | |||
@@ -102,6 +102,9 @@ enum sctp_cid { | |||
102 | /* AUTH Extension Section 4.1 */ | 102 | /* AUTH Extension Section 4.1 */ |
103 | SCTP_CID_AUTH = 0x0F, | 103 | SCTP_CID_AUTH = 0x0F, |
104 | 104 | ||
105 | /* sctp ndata 5.1. I-DATA */ | ||
106 | SCTP_CID_I_DATA = 0x40, | ||
107 | |||
105 | /* PR-SCTP Sec 3.2 */ | 108 | /* PR-SCTP Sec 3.2 */ |
106 | SCTP_CID_FWD_TSN = 0xC0, | 109 | SCTP_CID_FWD_TSN = 0xC0, |
107 | 110 | ||
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 9bf575f2e8ed..da33c8550170 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -228,7 +228,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, | |||
228 | struct sctp_inithdr init; | 228 | struct sctp_inithdr init; |
229 | union sctp_params addrs; | 229 | union sctp_params addrs; |
230 | struct sctp_sock *sp; | 230 | struct sctp_sock *sp; |
231 | __u8 extensions[4]; | 231 | __u8 extensions[5]; |
232 | size_t chunksize; | 232 | size_t chunksize; |
233 | __be16 types[2]; | 233 | __be16 types[2]; |
234 | int num_ext = 0; | 234 | int num_ext = 0; |
@@ -278,6 +278,11 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, | |||
278 | if (sp->adaptation_ind) | 278 | if (sp->adaptation_ind) |
279 | chunksize += sizeof(aiparam); | 279 | chunksize += sizeof(aiparam); |
280 | 280 | ||
281 | if (sp->strm_interleave) { | ||
282 | extensions[num_ext] = SCTP_CID_I_DATA; | ||
283 | num_ext += 1; | ||
284 | } | ||
285 | |||
281 | chunksize += vparam_len; | 286 | chunksize += vparam_len; |
282 | 287 | ||
283 | /* Account for AUTH related parameters */ | 288 | /* Account for AUTH related parameters */ |
@@ -392,7 +397,7 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc, | |||
392 | struct sctp_inithdr initack; | 397 | struct sctp_inithdr initack; |
393 | union sctp_params addrs; | 398 | union sctp_params addrs; |
394 | struct sctp_sock *sp; | 399 | struct sctp_sock *sp; |
395 | __u8 extensions[4]; | 400 | __u8 extensions[5]; |
396 | size_t chunksize; | 401 | size_t chunksize; |
397 | int num_ext = 0; | 402 | int num_ext = 0; |
398 | int cookie_len; | 403 | int cookie_len; |
@@ -442,6 +447,11 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc, | |||
442 | if (sp->adaptation_ind) | 447 | if (sp->adaptation_ind) |
443 | chunksize += sizeof(aiparam); | 448 | chunksize += sizeof(aiparam); |
444 | 449 | ||
450 | if (asoc->intl_enable) { | ||
451 | extensions[num_ext] = SCTP_CID_I_DATA; | ||
452 | num_ext += 1; | ||
453 | } | ||
454 | |||
445 | if (asoc->peer.auth_capable) { | 455 | if (asoc->peer.auth_capable) { |
446 | auth_random = (struct sctp_paramhdr *)asoc->c.auth_random; | 456 | auth_random = (struct sctp_paramhdr *)asoc->c.auth_random; |
447 | chunksize += ntohs(auth_random->length); | 457 | chunksize += ntohs(auth_random->length); |
@@ -2032,6 +2042,10 @@ static void sctp_process_ext_param(struct sctp_association *asoc, | |||
2032 | if (net->sctp.addip_enable) | 2042 | if (net->sctp.addip_enable) |
2033 | asoc->peer.asconf_capable = 1; | 2043 | asoc->peer.asconf_capable = 1; |
2034 | break; | 2044 | break; |
2045 | case SCTP_CID_I_DATA: | ||
2046 | if (sctp_sk(asoc->base.sk)->strm_interleave) | ||
2047 | asoc->intl_enable = 1; | ||
2048 | break; | ||
2035 | default: | 2049 | default: |
2036 | break; | 2050 | break; |
2037 | } | 2051 | } |