@@ -1844,6 +1844,7 @@ struct sctp_association *sctp_unpack_cookie(
1844
1844
retval -> next_tsn = retval -> c .initial_tsn ;
1845
1845
retval -> ctsn_ack_point = retval -> next_tsn - 1 ;
1846
1846
retval -> addip_serial = retval -> c .initial_tsn ;
1847
+ retval -> strreset_outseq = retval -> c .initial_tsn ;
1847
1848
retval -> adv_peer_ack_point = retval -> ctsn_ack_point ;
1848
1849
retval -> peer .prsctp_capable = retval -> c .prsctp_capable ;
1849
1850
retval -> peer .adaptation_ind = retval -> c .adaptation_ind ;
@@ -2387,6 +2388,8 @@ int sctp_process_init(struct sctp_association *asoc, struct sctp_chunk *chunk,
2387
2388
asoc -> peer .i .initial_tsn =
2388
2389
ntohl (peer_init -> init_hdr .initial_tsn );
2389
2390
2391
+ asoc -> strreset_inseq = asoc -> peer .i .initial_tsn ;
2392
+
2390
2393
/* Apply the upper bounds for output streams based on peer's
2391
2394
* number of inbound streams.
2392
2395
*/
@@ -3524,3 +3527,121 @@ struct sctp_chunk *sctp_make_fwdtsn(const struct sctp_association *asoc,
3524
3527
3525
3528
return retval ;
3526
3529
}
3530
+
3531
+ /* RE-CONFIG 3.1 (RE-CONFIG chunk)
3532
+ * 0 1 2 3
3533
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
3534
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3535
+ * | Type = 130 | Chunk Flags | Chunk Length |
3536
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3537
+ * \ \
3538
+ * / Re-configuration Parameter /
3539
+ * \ \
3540
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3541
+ * \ \
3542
+ * / Re-configuration Parameter (optional) /
3543
+ * \ \
3544
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3545
+ */
3546
+ static struct sctp_chunk * sctp_make_reconf (
3547
+ const struct sctp_association * asoc ,
3548
+ int length )
3549
+ {
3550
+ struct sctp_reconf_chunk * reconf ;
3551
+ struct sctp_chunk * retval ;
3552
+
3553
+ retval = sctp_make_control (asoc , SCTP_CID_RECONF , 0 , length ,
3554
+ GFP_ATOMIC );
3555
+ if (!retval )
3556
+ return NULL ;
3557
+
3558
+ reconf = (struct sctp_reconf_chunk * )retval -> chunk_hdr ;
3559
+ retval -> param_hdr .v = reconf -> params ;
3560
+
3561
+ return retval ;
3562
+ }
3563
+
3564
+ /* RE-CONFIG 4.1 (STREAM OUT RESET)
3565
+ * 0 1 2 3
3566
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
3567
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3568
+ * | Parameter Type = 13 | Parameter Length = 16 + 2 * N |
3569
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3570
+ * | Re-configuration Request Sequence Number |
3571
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3572
+ * | Re-configuration Response Sequence Number |
3573
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3574
+ * | Sender's Last Assigned TSN |
3575
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3576
+ * | Stream Number 1 (optional) | Stream Number 2 (optional) |
3577
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3578
+ * / ...... /
3579
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3580
+ * | Stream Number N-1 (optional) | Stream Number N (optional) |
3581
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3582
+ *
3583
+ * RE-CONFIG 4.2 (STREAM IN RESET)
3584
+ * 0 1 2 3
3585
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
3586
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3587
+ * | Parameter Type = 14 | Parameter Length = 8 + 2 * N |
3588
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3589
+ * | Re-configuration Request Sequence Number |
3590
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3591
+ * | Stream Number 1 (optional) | Stream Number 2 (optional) |
3592
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3593
+ * / ...... /
3594
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3595
+ * | Stream Number N-1 (optional) | Stream Number N (optional) |
3596
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3597
+ */
3598
+ struct sctp_chunk * sctp_make_strreset_req (
3599
+ const struct sctp_association * asoc ,
3600
+ __u16 stream_num , __u16 * stream_list ,
3601
+ bool out , bool in )
3602
+ {
3603
+ struct sctp_strreset_outreq outreq ;
3604
+ __u16 stream_len = stream_num * 2 ;
3605
+ struct sctp_strreset_inreq inreq ;
3606
+ struct sctp_chunk * retval ;
3607
+ __u16 outlen , inlen , i ;
3608
+
3609
+ outlen = (sizeof (outreq ) + stream_len ) * out ;
3610
+ inlen = (sizeof (inreq ) + stream_len ) * in ;
3611
+
3612
+ retval = sctp_make_reconf (asoc , outlen + inlen );
3613
+ if (!retval )
3614
+ return NULL ;
3615
+
3616
+ for (i = 0 ; i < stream_num ; i ++ )
3617
+ stream_list [i ] = htons (stream_list [i ]);
3618
+
3619
+ if (outlen ) {
3620
+ outreq .param_hdr .type = SCTP_PARAM_RESET_OUT_REQUEST ;
3621
+ outreq .param_hdr .length = htons (outlen );
3622
+ outreq .request_seq = htonl (asoc -> strreset_outseq );
3623
+ outreq .response_seq = htonl (asoc -> strreset_inseq - 1 );
3624
+ outreq .send_reset_at_tsn = htonl (asoc -> next_tsn - 1 );
3625
+
3626
+ sctp_addto_chunk (retval , sizeof (outreq ), & outreq );
3627
+
3628
+ if (stream_len )
3629
+ sctp_addto_chunk (retval , stream_len , stream_list );
3630
+ }
3631
+
3632
+ if (inlen ) {
3633
+ inreq .param_hdr .type = SCTP_PARAM_RESET_IN_REQUEST ;
3634
+ inreq .param_hdr .length = htons (inlen );
3635
+ inreq .request_seq = htonl (asoc -> strreset_outseq + out );
3636
+
3637
+ sctp_addto_chunk (retval , sizeof (inreq ), & inreq );
3638
+
3639
+ if (stream_len )
3640
+ sctp_addto_chunk (retval , stream_len , stream_list );
3641
+ }
3642
+
3643
+ for (i = 0 ; i < stream_num ; i ++ )
3644
+ stream_list [i ] = ntohs (stream_list [i ]);
3645
+
3646
+ return retval ;
3647
+ }
0 commit comments