112
112
#define SCTP_ECN_CWR 0x0d
113
113
#define SCTP_SHUTDOWN_COMPLETE 0x0e
114
114
#define SCTP_I_DATA 0x40
115
+ #define SCTP_RE_CONFIG 0x82
115
116
#define SCTP_FORWARD_CUM_TSN 0xc0
116
117
#define SCTP_RELIABLE_CNTL 0xc1
117
118
#define SCTP_I_FORWARD_TSN 0xc2
@@ -133,6 +134,7 @@ static const struct tok sctp_chunkid_str[] = {
133
134
{ SCTP_ECN_CWR , "ECN CWR" },
134
135
{ SCTP_SHUTDOWN_COMPLETE , "SHUTDOWN COMPLETE" },
135
136
{ SCTP_I_DATA , "I-DATA" },
137
+ { SCTP_RE_CONFIG , "RE-CONFIG" },
136
138
{ SCTP_FORWARD_CUM_TSN , "FOR CUM TSN" },
137
139
{ SCTP_RELIABLE_CNTL , "REL CTRL" },
138
140
{ SCTP_I_FORWARD_TSN , "I-FORWARD-FSN" },
@@ -151,6 +153,14 @@ static const struct tok sctp_chunkid_str[] = {
151
153
/* I-Forward-TSN Specific Flag */
152
154
#define SCTP_I_FORWARD_UNORDERED 0x01
153
155
156
+ /* RE-CONFIG Parameters */
157
+ #define OUT_SSN_RESET 13
158
+ #define IN_SSN_RESET 14
159
+ #define SSN_TSN_RESET 15
160
+ #define RE_CONFIG_RES 16
161
+ #define ADD_OUT_STREAM_REQ 17
162
+ #define ADD_IN_STREAM_REQ 18
163
+
154
164
#define SCTP_ADDRMAX 60
155
165
156
166
#define CHAN_HP 6704
@@ -374,6 +384,33 @@ struct sctpIForwardEntry{
374
384
nd_uint32_t MID ;
375
385
};
376
386
387
+ /* RE-CONFIG Parameters */
388
+ struct sctpReConfigHdr {
389
+ nd_uint16_t param_type ;
390
+ nd_uint16_t param_len ;
391
+ };
392
+
393
+ struct outGoingSSNReset {
394
+ nd_uint32_t re_config_req ;
395
+ nd_uint32_t re_config_res ;
396
+ nd_uint32_t last_assigned_TSN ;
397
+ };
398
+
399
+ struct inGoingSSNReset {
400
+ nd_uint32_t re_config_req ;
401
+ };
402
+
403
+ struct reConfigRes {
404
+ nd_uint32_t res_seq_num ;
405
+ nd_uint32_t result ;
406
+ };
407
+
408
+ struct addStreamReq {
409
+ nd_uint32_t res_seq_num ;
410
+ nd_uint16_t num_new_stream ;
411
+ nd_uint16_t reserved ;
412
+ };
413
+
377
414
struct sctpUnifiedDatagram {
378
415
struct sctpChunkDesc uh ;
379
416
struct sctpDataPart dp ;
@@ -390,6 +427,28 @@ struct sctpCWR{
390
427
nd_uint32_t TSN_reduced_at ;
391
428
};
392
429
430
+ /* RE-CONFIG Parameters */
431
+ static const struct tok RE_CONFIG_parameters [] = {
432
+ { OUT_SSN_RESET , "OUT SSN RESET" },
433
+ { IN_SSN_RESET , "IN SSN RESET" },
434
+ { SSN_TSN_RESET , "SSN/TSN Reset" },
435
+ { RE_CONFIG_RES , "RESP" },
436
+ { ADD_OUT_STREAM_REQ , "ADD OUT STREAM" },
437
+ { ADD_IN_STREAM_REQ , "ADD IN STREAM" },
438
+ { 0 , NULL }
439
+ };
440
+
441
+ static const struct tok results [] = {
442
+ { 0 , "Success - Nothing to do" },
443
+ { 1 , "Success - Performed" },
444
+ { 2 , "Denied" },
445
+ { 3 , "Error - Wrong SSN" },
446
+ { 4 , "Error - Request already in progress" },
447
+ { 5 , "Error - Bad Sequence Number" },
448
+ { 6 , "In progress" },
449
+ { 0 , NULL }
450
+ };
451
+
393
452
static const struct tok ForCES_channels [] = {
394
453
{ CHAN_HP , "ForCES HP" },
395
454
{ CHAN_MP , "ForCES MP" },
@@ -872,6 +931,196 @@ sctp_print(netdissect_options *ndo,
872
931
ND_PRINT ("\n\t\t[dup TSN #%u: %u] " , tsnNo + 1 ,
873
932
GET_BE_U_4 (dupTSN ));
874
933
}
934
+ break ;
935
+ }
936
+ case SCTP_RE_CONFIG :
937
+ {
938
+ const struct sctpReConfigHdr * param ;
939
+ uint16_t param_len , type ;
940
+ uint8_t padding_len ;
941
+
942
+ sctpPacketLengthRemaining -= chunkLengthRemaining ;
943
+
944
+ /* it's a padding if the remaining length is less than 4 */
945
+ while (chunkLengthRemaining >= sizeof (uint32_t )) {
946
+
947
+ ND_ICHECKMSG_ZU ("chunk length" , chunkLengthRemaining , < , sizeof (* param ));
948
+ param = (const struct sctpReConfigHdr * )bp ;
949
+ type = GET_BE_U_2 (param -> param_type );
950
+ param_len = GET_BE_U_2 (param -> param_len );
951
+ padding_len = ((param_len + 3 ) & ~ 3 ) - param_len ;
952
+ ND_ICHECKMSG_ZU ("parameter length" , param_len , < , sizeof (* param ));
953
+
954
+ ND_PRINT ("[%s" , tok2str (RE_CONFIG_parameters , NULL , type ));
955
+
956
+ param_len -= sizeof (* param );
957
+ chunkLengthRemaining -= sizeof (* param );
958
+ bp += sizeof (* param );
959
+
960
+ ND_ICHECKMSG_U ("chunk length" , chunkLengthRemaining , < , param_len );
961
+
962
+ /* if verbose level < 2, stop and skip */
963
+ if (ndo -> ndo_vflag < 2 ) {
964
+ ND_PRINT ("]" );
965
+
966
+ bp += param_len ;
967
+ chunkLengthRemaining -= param_len ;
968
+ /* skipping the parameter padding if there are more
969
+ * parameters in the remaining length */
970
+ if (chunkLengthRemaining > sizeof (uint32_t )) {
971
+ bp += padding_len ;
972
+ chunkLengthRemaining -= padding_len ;
973
+ }
974
+
975
+ continue ;
976
+ }
977
+
978
+ switch (type ) {
979
+ case OUT_SSN_RESET :
980
+ {
981
+ uint16_t stream_num = 0 ;
982
+ const struct outGoingSSNReset * content ;
983
+
984
+ ND_ICHECKMSG_ZU ("parameter length" , param_len , < , sizeof (* content ));
985
+
986
+ content = (const struct outGoingSSNReset * ) bp ;
987
+ ND_PRINT (": REQ SEQ: %u, " , GET_BE_U_4 (content -> re_config_req ));
988
+ ND_PRINT ("RES SEQ: %u, " , GET_BE_U_4 (content -> re_config_res ));
989
+ ND_PRINT ("Last TSN: %u, " , GET_BE_U_4 (content -> last_assigned_TSN ));
990
+
991
+ bp += sizeof (* content );
992
+ param_len -= sizeof (* content );
993
+ chunkLengthRemaining -= sizeof (* content );
994
+
995
+ ND_PRINT ("SID" );
996
+ while (param_len > 0 ) {
997
+ ND_ICHECKMSG_ZU ("chunk length" , chunkLengthRemaining , < , sizeof (stream_num ));
998
+ ND_ICHECKMSG_ZU ("parameter length" , param_len , < , sizeof (stream_num ));
999
+ stream_num = GET_BE_U_2 (bp );
1000
+ ND_PRINT (" %u" , stream_num );
1001
+
1002
+ bp += sizeof (stream_num );
1003
+ param_len -= sizeof (stream_num );
1004
+ chunkLengthRemaining -= sizeof (stream_num );
1005
+ }
1006
+ ND_PRINT ("]" );
1007
+
1008
+ break ;
1009
+ }
1010
+ case IN_SSN_RESET :
1011
+ {
1012
+ uint16_t stream_num = 0 ;
1013
+ const struct inGoingSSNReset * content ;
1014
+
1015
+ ND_ICHECKMSG_ZU ("parameter length" , param_len , < , sizeof (* content ));
1016
+
1017
+ content = (const struct inGoingSSNReset * ) bp ;
1018
+ ND_PRINT (": REQ SEQ: %u, " , GET_BE_U_4 (content -> re_config_req ));
1019
+
1020
+ bp += sizeof (* content );
1021
+ param_len -= sizeof (* content );
1022
+ chunkLengthRemaining -= sizeof (* content );
1023
+
1024
+ ND_PRINT ("SID" );
1025
+ while (param_len > 0 ) {
1026
+ ND_ICHECKMSG_ZU ("parameter length" , param_len , < , sizeof (stream_num ));
1027
+ stream_num = GET_BE_U_2 (bp );
1028
+ ND_PRINT (" %u" , stream_num );
1029
+
1030
+ bp += sizeof (stream_num );
1031
+ param_len -= sizeof (stream_num );
1032
+ chunkLengthRemaining -= sizeof (stream_num );
1033
+ }
1034
+ ND_PRINT ("]" );
1035
+
1036
+ break ;
1037
+ }
1038
+ case SSN_TSN_RESET :
1039
+ {
1040
+ /* reuse inGoingSSNReset struct as their structure are the same*/
1041
+ const struct inGoingSSNReset * content ;
1042
+
1043
+ ND_ICHECKMSG_ZU ("parameter length" , param_len , < , sizeof (* content ));
1044
+
1045
+ content = (const struct inGoingSSNReset * ) bp ;
1046
+ ND_PRINT (": REQ SEQ: %u]" , GET_BE_U_4 (content -> re_config_req ));
1047
+
1048
+ bp += sizeof (* content );
1049
+ chunkLengthRemaining -= sizeof (* content );
1050
+
1051
+ break ;
1052
+ }
1053
+ case RE_CONFIG_RES :
1054
+ {
1055
+ uint32_t optional = 0 ;
1056
+ const size_t optional_size = sizeof (optional );
1057
+ const struct reConfigRes * content ;
1058
+
1059
+ ND_ICHECKMSG_ZU ("parameter length" , param_len , < , sizeof (* content ));
1060
+
1061
+ content = (const struct reConfigRes * ) bp ;
1062
+ ND_PRINT (": REQ SEQ: %u, " , GET_BE_U_4 (content -> res_seq_num ));
1063
+ ND_PRINT ("REQ: %s" , tok2str (results , NULL , GET_BE_U_4 (content -> result )));
1064
+
1065
+ bp += sizeof (* content );
1066
+ param_len -= sizeof (* content );
1067
+ chunkLengthRemaining -= sizeof (* content );
1068
+
1069
+ if (0 == param_len ) {
1070
+ ND_PRINT ("]" );
1071
+ break ;
1072
+ }
1073
+
1074
+ /* either both or none must be present */
1075
+ ND_ICHECKMSG_ZU ("parameter length" , param_len , < , 2 * optional_size );
1076
+ optional = GET_BE_U_4 (bp );
1077
+ ND_PRINT (", Sender's TSN: %u" , optional );
1078
+
1079
+ bp += optional_size ;
1080
+ param_len -= optional_size ;
1081
+ chunkLengthRemaining -= optional_size ;
1082
+
1083
+ optional = GET_BE_U_4 (bp );
1084
+ ND_PRINT (", Receiver's Next TSN: %u] " , optional );
1085
+
1086
+ bp += optional_size ;
1087
+ chunkLengthRemaining -= optional_size ;
1088
+
1089
+ break ;
1090
+ }
1091
+ case ADD_OUT_STREAM_REQ :
1092
+ case ADD_IN_STREAM_REQ :
1093
+ {
1094
+ const struct addStreamReq * content ;
1095
+
1096
+ ND_ICHECKMSG_ZU ("parameter length" , param_len , < , sizeof (* content ));
1097
+
1098
+ content = (const struct addStreamReq * ) bp ;
1099
+ ND_PRINT (": REQ SEQ: %u, " , GET_BE_U_4 (content -> res_seq_num ));
1100
+ ND_PRINT ("No. of new streams: %u] " , GET_BE_U_2 (content -> num_new_stream ));
1101
+
1102
+ bp += sizeof (* content );
1103
+ chunkLengthRemaining -= sizeof (* content );
1104
+
1105
+ break ;
1106
+ }
1107
+ default :
1108
+ {
1109
+ bp += chunkLengthRemaining ;
1110
+ chunkLengthRemaining = 0 ;
1111
+ break ;
1112
+ }
1113
+ }
1114
+ /* skipping the parameter padding if there are more parameters
1115
+ * in the remaining length */
1116
+ if (chunkLengthRemaining > sizeof (uint32_t )) {
1117
+ bp += padding_len ;
1118
+ chunkLengthRemaining -= padding_len ;
1119
+ }
1120
+ }
1121
+ bp += chunkLengthRemaining ;
1122
+ chunkLengthRemaining = 0 ;
1123
+
875
1124
break ;
876
1125
}
877
1126
default :
0 commit comments