Deleted Added
full compact
sctp_indata.c (234995) sctp_indata.c (235360)
1/*-
2 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
3 * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
4 * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *

--- 19 unchanged lines hidden (view full) ---

28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33/* $KAME: sctp_indata.c,v 1.36 2005/03/06 16:04:17 itojun Exp $ */
34
35#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
3 * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
4 * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *

--- 19 unchanged lines hidden (view full) ---

28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33/* $KAME: sctp_indata.c,v 1.36 2005/03/06 16:04:17 itojun Exp $ */
34
35#include <sys/cdefs.h>
36__FBSDID("$FreeBSD: head/sys/netinet/sctp_indata.c 234995 2012-05-04 09:27:00Z tuexen $");
36__FBSDID("$FreeBSD: head/sys/netinet/sctp_indata.c 235360 2012-05-12 20:11:35Z tuexen $");
37
38#include <netinet/sctp_os.h>
39#include <netinet/sctp_var.h>
40#include <netinet/sctp_sysctl.h>
41#include <netinet/sctp_pcb.h>
42#include <netinet/sctp_header.h>
43#include <netinet/sctputil.h>
44#include <netinet/sctp_output.h>

--- 557 unchanged lines hidden (view full) ---

602 ippp = (uint32_t *) (ph + 1);
603 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_1);
604 ippp++;
605 *ippp = control->sinfo_tsn;
606 ippp++;
607 *ippp = ((control->sinfo_stream << 16) | control->sinfo_ssn);
608 }
609 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_1;
37
38#include <netinet/sctp_os.h>
39#include <netinet/sctp_var.h>
40#include <netinet/sctp_sysctl.h>
41#include <netinet/sctp_pcb.h>
42#include <netinet/sctp_header.h>
43#include <netinet/sctputil.h>
44#include <netinet/sctp_output.h>

--- 557 unchanged lines hidden (view full) ---

602 ippp = (uint32_t *) (ph + 1);
603 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_1);
604 ippp++;
605 *ippp = control->sinfo_tsn;
606 ippp++;
607 *ippp = ((control->sinfo_stream << 16) | control->sinfo_ssn);
608 }
609 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_1;
610 sctp_abort_an_association(stcb->sctp_ep, stcb,
611 SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED);
612
610 sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED);
613 *abort_flag = 1;
614 return;
615
616 }
617 if (nxt_todel == control->sinfo_ssn) {
618 /* can be delivered right away? */
619 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) {
620 sctp_log_strm_del(control, NULL, SCTP_STR_LOG_FROM_IMMED_DEL);

--- 266 unchanged lines hidden (view full) ---

887 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_2);
888 ippp++;
889 *ippp = chk->rec.data.TSN_seq;
890 ippp++;
891 *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq);
892
893 }
894 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_2;
611 *abort_flag = 1;
612 return;
613
614 }
615 if (nxt_todel == control->sinfo_ssn) {
616 /* can be delivered right away? */
617 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) {
618 sctp_log_strm_del(control, NULL, SCTP_STR_LOG_FROM_IMMED_DEL);

--- 266 unchanged lines hidden (view full) ---

885 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_2);
886 ippp++;
887 *ippp = chk->rec.data.TSN_seq;
888 ippp++;
889 *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq);
890
891 }
892 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_2;
895 sctp_abort_an_association(stcb->sctp_ep, stcb,
896 SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED);
893 sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED);
897 *abort_flag = 1;
898 } else if (asoc->fragmented_delivery_inprogress &&
899 (chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) == SCTP_DATA_FIRST_FRAG) {
900 /*
901 * We are doing a partial delivery and the
902 * NEXT chunk MUST be either the LAST or
903 * MIDDLE fragment NOT a FIRST
904 */

--- 14 unchanged lines hidden (view full) ---

919 ippp = (uint32_t *) (ph + 1);
920 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_3);
921 ippp++;
922 *ippp = chk->rec.data.TSN_seq;
923 ippp++;
924 *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq);
925 }
926 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_3;
894 *abort_flag = 1;
895 } else if (asoc->fragmented_delivery_inprogress &&
896 (chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) == SCTP_DATA_FIRST_FRAG) {
897 /*
898 * We are doing a partial delivery and the
899 * NEXT chunk MUST be either the LAST or
900 * MIDDLE fragment NOT a FIRST
901 */

--- 14 unchanged lines hidden (view full) ---

916 ippp = (uint32_t *) (ph + 1);
917 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_3);
918 ippp++;
919 *ippp = chk->rec.data.TSN_seq;
920 ippp++;
921 *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq);
922 }
923 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_3;
927 sctp_abort_an_association(stcb->sctp_ep, stcb,
928 SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED);
924 sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED);
929 *abort_flag = 1;
930 } else if (asoc->fragmented_delivery_inprogress) {
931 /*
932 * Here we are ok with a MIDDLE or LAST
933 * piece
934 */
935 if (chk->rec.data.stream_number !=
936 asoc->str_of_pdapi) {

--- 19 unchanged lines hidden (view full) ---

956 ippp = (uint32_t *) (ph + 1);
957 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_4);
958 ippp++;
959 *ippp = chk->rec.data.TSN_seq;
960 ippp++;
961 *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq);
962 }
963 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_4;
925 *abort_flag = 1;
926 } else if (asoc->fragmented_delivery_inprogress) {
927 /*
928 * Here we are ok with a MIDDLE or LAST
929 * piece
930 */
931 if (chk->rec.data.stream_number !=
932 asoc->str_of_pdapi) {

--- 19 unchanged lines hidden (view full) ---

952 ippp = (uint32_t *) (ph + 1);
953 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_4);
954 ippp++;
955 *ippp = chk->rec.data.TSN_seq;
956 ippp++;
957 *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq);
958 }
959 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_4;
964 sctp_abort_an_association(stcb->sctp_ep,
965 stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED);
960 sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED);
966 *abort_flag = 1;
967 } else if ((asoc->fragment_flags & SCTP_DATA_UNORDERED) !=
968 SCTP_DATA_UNORDERED &&
969 chk->rec.data.stream_seq != asoc->ssn_of_pdapi) {
970 /* Got to be the right STR Seq */
971 SCTPDBG(SCTP_DEBUG_INDATA1, "Gak, Evil plot, it IS not same stream seq %d vs %d\n",
972 chk->rec.data.stream_seq,
973 asoc->ssn_of_pdapi);

--- 16 unchanged lines hidden (view full) ---

990 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_5);
991 ippp++;
992 *ippp = chk->rec.data.TSN_seq;
993 ippp++;
994 *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq);
995
996 }
997 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_5;
961 *abort_flag = 1;
962 } else if ((asoc->fragment_flags & SCTP_DATA_UNORDERED) !=
963 SCTP_DATA_UNORDERED &&
964 chk->rec.data.stream_seq != asoc->ssn_of_pdapi) {
965 /* Got to be the right STR Seq */
966 SCTPDBG(SCTP_DEBUG_INDATA1, "Gak, Evil plot, it IS not same stream seq %d vs %d\n",
967 chk->rec.data.stream_seq,
968 asoc->ssn_of_pdapi);

--- 16 unchanged lines hidden (view full) ---

985 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_5);
986 ippp++;
987 *ippp = chk->rec.data.TSN_seq;
988 ippp++;
989 *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq);
990
991 }
992 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_5;
998 sctp_abort_an_association(stcb->sctp_ep,
999 stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED);
993 sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED);
1000 *abort_flag = 1;
1001 }
1002 }
1003 }
1004 return;
1005 }
1006 /* Find its place */
1007 TAILQ_FOREACH(at, &asoc->reasmqueue, sctp_next) {

--- 77 unchanged lines hidden (view full) ---

1085 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_6);
1086 ippp++;
1087 *ippp = chk->rec.data.TSN_seq;
1088 ippp++;
1089 *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq);
1090
1091 }
1092 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_6;
994 *abort_flag = 1;
995 }
996 }
997 }
998 return;
999 }
1000 /* Find its place */
1001 TAILQ_FOREACH(at, &asoc->reasmqueue, sctp_next) {

--- 77 unchanged lines hidden (view full) ---

1079 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_6);
1080 ippp++;
1081 *ippp = chk->rec.data.TSN_seq;
1082 ippp++;
1083 *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq);
1084
1085 }
1086 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_6;
1093 sctp_abort_an_association(stcb->sctp_ep,
1094 stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED);
1087 sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED);
1095 *abort_flag = 1;
1096 return;
1097 }
1098 if (chk->rec.data.stream_number !=
1099 prev->rec.data.stream_number) {
1100 /*
1101 * Huh, need the correct STR here,
1102 * they must be the same.

--- 19 unchanged lines hidden (view full) ---

1122 ippp = (uint32_t *) (ph + 1);
1123 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_7);
1124 ippp++;
1125 *ippp = chk->rec.data.TSN_seq;
1126 ippp++;
1127 *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq);
1128 }
1129 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_7;
1088 *abort_flag = 1;
1089 return;
1090 }
1091 if (chk->rec.data.stream_number !=
1092 prev->rec.data.stream_number) {
1093 /*
1094 * Huh, need the correct STR here,
1095 * they must be the same.

--- 19 unchanged lines hidden (view full) ---

1115 ippp = (uint32_t *) (ph + 1);
1116 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_7);
1117 ippp++;
1118 *ippp = chk->rec.data.TSN_seq;
1119 ippp++;
1120 *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq);
1121 }
1122 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_7;
1130 sctp_abort_an_association(stcb->sctp_ep,
1131 stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED);
1132
1123 sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED);
1133 *abort_flag = 1;
1134 return;
1135 }
1136 if ((prev->rec.data.rcv_flags & SCTP_DATA_UNORDERED) == 0 &&
1137 chk->rec.data.stream_seq !=
1138 prev->rec.data.stream_seq) {
1139 /*
1140 * Huh, need the correct STR here,

--- 20 unchanged lines hidden (view full) ---

1161 ippp = (uint32_t *) (ph + 1);
1162 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_8);
1163 ippp++;
1164 *ippp = chk->rec.data.TSN_seq;
1165 ippp++;
1166 *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq);
1167 }
1168 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_8;
1124 *abort_flag = 1;
1125 return;
1126 }
1127 if ((prev->rec.data.rcv_flags & SCTP_DATA_UNORDERED) == 0 &&
1128 chk->rec.data.stream_seq !=
1129 prev->rec.data.stream_seq) {
1130 /*
1131 * Huh, need the correct STR here,

--- 20 unchanged lines hidden (view full) ---

1152 ippp = (uint32_t *) (ph + 1);
1153 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_8);
1154 ippp++;
1155 *ippp = chk->rec.data.TSN_seq;
1156 ippp++;
1157 *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq);
1158 }
1159 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_8;
1169 sctp_abort_an_association(stcb->sctp_ep,
1170 stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED);
1171
1160 sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED);
1172 *abort_flag = 1;
1173 return;
1174 }
1175 } else if ((prev->rec.data.rcv_flags & SCTP_DATA_FRAG_MASK) ==
1176 SCTP_DATA_LAST_FRAG) {
1177 /* Insert chk MUST be a FIRST */
1178 if ((chk->rec.data.rcv_flags & SCTP_DATA_FRAG_MASK) !=
1179 SCTP_DATA_FIRST_FRAG) {

--- 17 unchanged lines hidden (view full) ---

1197 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_9);
1198 ippp++;
1199 *ippp = chk->rec.data.TSN_seq;
1200 ippp++;
1201 *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq);
1202
1203 }
1204 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_9;
1161 *abort_flag = 1;
1162 return;
1163 }
1164 } else if ((prev->rec.data.rcv_flags & SCTP_DATA_FRAG_MASK) ==
1165 SCTP_DATA_LAST_FRAG) {
1166 /* Insert chk MUST be a FIRST */
1167 if ((chk->rec.data.rcv_flags & SCTP_DATA_FRAG_MASK) !=
1168 SCTP_DATA_FIRST_FRAG) {

--- 17 unchanged lines hidden (view full) ---

1186 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_9);
1187 ippp++;
1188 *ippp = chk->rec.data.TSN_seq;
1189 ippp++;
1190 *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq);
1191
1192 }
1193 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_9;
1205 sctp_abort_an_association(stcb->sctp_ep,
1206 stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED);
1207
1194 sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED);
1208 *abort_flag = 1;
1209 return;
1210 }
1211 }
1212 }
1213 }
1214 if (next) {
1215 post_tsn = chk->rec.data.TSN_seq + 1;

--- 26 unchanged lines hidden (view full) ---

1242 ippp = (uint32_t *) (ph + 1);
1243 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_10);
1244 ippp++;
1245 *ippp = chk->rec.data.TSN_seq;
1246 ippp++;
1247 *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq);
1248 }
1249 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_10;
1195 *abort_flag = 1;
1196 return;
1197 }
1198 }
1199 }
1200 }
1201 if (next) {
1202 post_tsn = chk->rec.data.TSN_seq + 1;

--- 26 unchanged lines hidden (view full) ---

1229 ippp = (uint32_t *) (ph + 1);
1230 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_10);
1231 ippp++;
1232 *ippp = chk->rec.data.TSN_seq;
1233 ippp++;
1234 *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq);
1235 }
1236 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_10;
1250 sctp_abort_an_association(stcb->sctp_ep,
1251 stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED);
1252
1237 sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED);
1253 *abort_flag = 1;
1254 return;
1255 }
1256 } else if ((next->rec.data.rcv_flags & SCTP_DATA_FRAG_MASK) ==
1257 SCTP_DATA_MIDDLE_FRAG ||
1258 (next->rec.data.rcv_flags & SCTP_DATA_FRAG_MASK) ==
1259 SCTP_DATA_LAST_FRAG) {
1260 /*

--- 23 unchanged lines hidden (view full) ---

1284 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_11);
1285 ippp++;
1286 *ippp = chk->rec.data.TSN_seq;
1287 ippp++;
1288 *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq);
1289
1290 }
1291 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_11;
1238 *abort_flag = 1;
1239 return;
1240 }
1241 } else if ((next->rec.data.rcv_flags & SCTP_DATA_FRAG_MASK) ==
1242 SCTP_DATA_MIDDLE_FRAG ||
1243 (next->rec.data.rcv_flags & SCTP_DATA_FRAG_MASK) ==
1244 SCTP_DATA_LAST_FRAG) {
1245 /*

--- 23 unchanged lines hidden (view full) ---

1269 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_11);
1270 ippp++;
1271 *ippp = chk->rec.data.TSN_seq;
1272 ippp++;
1273 *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq);
1274
1275 }
1276 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_11;
1292 sctp_abort_an_association(stcb->sctp_ep,
1293 stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED);
1294
1277 sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED);
1295 *abort_flag = 1;
1296 return;
1297 }
1298 if (chk->rec.data.stream_number !=
1299 next->rec.data.stream_number) {
1300 /*
1301 * Huh, need the correct STR here,
1302 * they must be the same.

--- 20 unchanged lines hidden (view full) ---

1323 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_12);
1324 ippp++;
1325 *ippp = chk->rec.data.TSN_seq;
1326 ippp++;
1327 *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq);
1328
1329 }
1330 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_12;
1278 *abort_flag = 1;
1279 return;
1280 }
1281 if (chk->rec.data.stream_number !=
1282 next->rec.data.stream_number) {
1283 /*
1284 * Huh, need the correct STR here,
1285 * they must be the same.

--- 20 unchanged lines hidden (view full) ---

1306 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_12);
1307 ippp++;
1308 *ippp = chk->rec.data.TSN_seq;
1309 ippp++;
1310 *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq);
1311
1312 }
1313 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_12;
1331 sctp_abort_an_association(stcb->sctp_ep,
1332 stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED);
1333
1314 sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED);
1334 *abort_flag = 1;
1335 return;
1336 }
1337 if ((next->rec.data.rcv_flags & SCTP_DATA_UNORDERED) == 0 &&
1338 chk->rec.data.stream_seq !=
1339 next->rec.data.stream_seq) {
1340 /*
1341 * Huh, need the correct STR here,

--- 20 unchanged lines hidden (view full) ---

1362 ippp = (uint32_t *) (ph + 1);
1363 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_13);
1364 ippp++;
1365 *ippp = chk->rec.data.TSN_seq;
1366 ippp++;
1367 *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq);
1368 }
1369 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_13;
1315 *abort_flag = 1;
1316 return;
1317 }
1318 if ((next->rec.data.rcv_flags & SCTP_DATA_UNORDERED) == 0 &&
1319 chk->rec.data.stream_seq !=
1320 next->rec.data.stream_seq) {
1321 /*
1322 * Huh, need the correct STR here,

--- 20 unchanged lines hidden (view full) ---

1343 ippp = (uint32_t *) (ph + 1);
1344 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_13);
1345 ippp++;
1346 *ippp = chk->rec.data.TSN_seq;
1347 ippp++;
1348 *ippp = ((chk->rec.data.stream_number << 16) | chk->rec.data.stream_seq);
1349 }
1350 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_13;
1370 sctp_abort_an_association(stcb->sctp_ep,
1371 stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED);
1372
1351 sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED);
1373 *abort_flag = 1;
1374 return;
1375 }
1376 }
1377 }
1378 }
1379 /* Do we need to do some delivery? check */
1380 sctp_deliver_reasm_check(stcb, asoc);

--- 145 unchanged lines hidden (view full) ---

1526 ) {
1527 /*
1528 * wait a minute, this guy is gone, there is no longer a
1529 * receiver. Send peer an ABORT!
1530 */
1531 struct mbuf *op_err;
1532
1533 op_err = sctp_generate_invmanparam(SCTP_CAUSE_OUT_OF_RESC);
1352 *abort_flag = 1;
1353 return;
1354 }
1355 }
1356 }
1357 }
1358 /* Do we need to do some delivery? check */
1359 sctp_deliver_reasm_check(stcb, asoc);

--- 145 unchanged lines hidden (view full) ---

1505 ) {
1506 /*
1507 * wait a minute, this guy is gone, there is no longer a
1508 * receiver. Send peer an ABORT!
1509 */
1510 struct mbuf *op_err;
1511
1512 op_err = sctp_generate_invmanparam(SCTP_CAUSE_OUT_OF_RESC);
1534 sctp_abort_an_association(stcb->sctp_ep, stcb, 0, op_err, SCTP_SO_NOT_LOCKED);
1513 sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED);
1535 *abort_flag = 1;
1536 return (0);
1537 }
1538 /*
1539 * Now before going further we see if there is room. If NOT then we
1540 * MAY let one through only IF this TSN is the one we are waiting
1541 * for on a partial delivery API.
1542 */

--- 130 unchanged lines hidden (view full) ---

1673 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_14);
1674 ippp++;
1675 *ippp = tsn;
1676 ippp++;
1677 *ippp = ((strmno << 16) | strmseq);
1678
1679 }
1680 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_14;
1514 *abort_flag = 1;
1515 return (0);
1516 }
1517 /*
1518 * Now before going further we see if there is room. If NOT then we
1519 * MAY let one through only IF this TSN is the one we are waiting
1520 * for on a partial delivery API.
1521 */

--- 130 unchanged lines hidden (view full) ---

1652 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_14);
1653 ippp++;
1654 *ippp = tsn;
1655 ippp++;
1656 *ippp = ((strmno << 16) | strmseq);
1657
1658 }
1659 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_14;
1681 sctp_abort_an_association(stcb->sctp_ep, stcb,
1682 SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED);
1660 sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED);
1683 *abort_flag = 1;
1684 return (0);
1685 }
1686 /************************************
1687 * From here down we may find ch-> invalid
1688 * so its a good idea NOT to use it.
1689 *************************************/
1690

--- 246 unchanged lines hidden (view full) ---

1937 ippp = (uint32_t *) (ph + 1);
1938 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_15);
1939 ippp++;
1940 *ippp = tsn;
1941 ippp++;
1942 *ippp = ((strmno << 16) | strmseq);
1943 }
1944 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_15;
1661 *abort_flag = 1;
1662 return (0);
1663 }
1664 /************************************
1665 * From here down we may find ch-> invalid
1666 * so its a good idea NOT to use it.
1667 *************************************/
1668

--- 246 unchanged lines hidden (view full) ---

1915 ippp = (uint32_t *) (ph + 1);
1916 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_15);
1917 ippp++;
1918 *ippp = tsn;
1919 ippp++;
1920 *ippp = ((strmno << 16) | strmseq);
1921 }
1922 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_15;
1945 sctp_abort_an_association(stcb->sctp_ep, stcb,
1946 SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED);
1947
1923 sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED);
1948 *abort_flag = 1;
1949 return (0);
1950 } else {
1951 if (sctp_does_tsn_belong_to_reasm(asoc, control->sinfo_tsn)) {
1952 sctp_m_freem(control->data);
1953 control->data = NULL;
1954 if (control->whoFrom) {
1955 sctp_free_remote_addr(control->whoFrom);

--- 19 unchanged lines hidden (view full) ---

1975 ippp = (uint32_t *) (ph + 1);
1976 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_16);
1977 ippp++;
1978 *ippp = tsn;
1979 ippp++;
1980 *ippp = ((strmno << 16) | strmseq);
1981 }
1982 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_16;
1924 *abort_flag = 1;
1925 return (0);
1926 } else {
1927 if (sctp_does_tsn_belong_to_reasm(asoc, control->sinfo_tsn)) {
1928 sctp_m_freem(control->data);
1929 control->data = NULL;
1930 if (control->whoFrom) {
1931 sctp_free_remote_addr(control->whoFrom);

--- 19 unchanged lines hidden (view full) ---

1951 ippp = (uint32_t *) (ph + 1);
1952 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_16);
1953 ippp++;
1954 *ippp = tsn;
1955 ippp++;
1956 *ippp = ((strmno << 16) | strmseq);
1957 }
1958 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_16;
1983 sctp_abort_an_association(stcb->sctp_ep,
1984 stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED);
1985
1959 sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED);
1986 *abort_flag = 1;
1987 return (0);
1988 }
1989 }
1990 } else {
1991 /* No PDAPI running */
1992 if (!TAILQ_EMPTY(&asoc->reasmqueue)) {
1993 /*

--- 28 unchanged lines hidden (view full) ---

2022 ippp = (uint32_t *) (ph + 1);
2023 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_17);
2024 ippp++;
2025 *ippp = tsn;
2026 ippp++;
2027 *ippp = ((strmno << 16) | strmseq);
2028 }
2029 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_17;
1960 *abort_flag = 1;
1961 return (0);
1962 }
1963 }
1964 } else {
1965 /* No PDAPI running */
1966 if (!TAILQ_EMPTY(&asoc->reasmqueue)) {
1967 /*

--- 28 unchanged lines hidden (view full) ---

1996 ippp = (uint32_t *) (ph + 1);
1997 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_17);
1998 ippp++;
1999 *ippp = tsn;
2000 ippp++;
2001 *ippp = ((strmno << 16) | strmseq);
2002 }
2003 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_17;
2030 sctp_abort_an_association(stcb->sctp_ep,
2031 stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED);
2032
2004 sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED);
2033 *abort_flag = 1;
2034 return (0);
2035 }
2036 }
2037 }
2038 /* ok, if we reach here we have passed the sanity checks */
2039 if (chunk_flags & SCTP_DATA_UNORDERED) {
2040 /* queue directly into socket buffer */

--- 1832 unchanged lines hidden (view full) ---

3873 sizeof(uint32_t);
3874 ph = mtod(oper, struct sctp_paramhdr *);
3875 ph->param_type = htons(SCTP_CAUSE_PROTOCOL_VIOLATION);
3876 ph->param_length = htons(SCTP_BUF_LEN(oper));
3877 ippp = (uint32_t *) (ph + 1);
3878 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_25);
3879 }
3880 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_25;
2005 *abort_flag = 1;
2006 return (0);
2007 }
2008 }
2009 }
2010 /* ok, if we reach here we have passed the sanity checks */
2011 if (chunk_flags & SCTP_DATA_UNORDERED) {
2012 /* queue directly into socket buffer */

--- 1832 unchanged lines hidden (view full) ---

3845 sizeof(uint32_t);
3846 ph = mtod(oper, struct sctp_paramhdr *);
3847 ph->param_type = htons(SCTP_CAUSE_PROTOCOL_VIOLATION);
3848 ph->param_length = htons(SCTP_BUF_LEN(oper));
3849 ippp = (uint32_t *) (ph + 1);
3850 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_25);
3851 }
3852 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_25;
3881 sctp_abort_an_association(stcb->sctp_ep, stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED);
3853 sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED);
3882 return;
3883#endif
3884 }
3885 }
3886 asoc->this_sack_highest_gap = cumack;
3887 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) {
3888 sctp_misc_ints(SCTP_THRESHOLD_CLEAR,
3889 stcb->asoc.overall_error_count,

--- 345 unchanged lines hidden (view full) ---

4235 sizeof(uint32_t);
4236 ph = mtod(oper, struct sctp_paramhdr *);
4237 ph->param_type = htons(SCTP_CAUSE_USER_INITIATED_ABT);
4238 ph->param_length = htons(SCTP_BUF_LEN(oper));
4239 ippp = (uint32_t *) (ph + 1);
4240 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_24);
4241 }
4242 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_24;
3854 return;
3855#endif
3856 }
3857 }
3858 asoc->this_sack_highest_gap = cumack;
3859 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) {
3860 sctp_misc_ints(SCTP_THRESHOLD_CLEAR,
3861 stcb->asoc.overall_error_count,

--- 345 unchanged lines hidden (view full) ---

4207 sizeof(uint32_t);
4208 ph = mtod(oper, struct sctp_paramhdr *);
4209 ph->param_type = htons(SCTP_CAUSE_USER_INITIATED_ABT);
4210 ph->param_length = htons(SCTP_BUF_LEN(oper));
4211 ippp = (uint32_t *) (ph + 1);
4212 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_24);
4213 }
4214 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_24;
4243 sctp_abort_an_association(stcb->sctp_ep, stcb, SCTP_RESPONSE_TO_USER_REQ, oper, SCTP_SO_NOT_LOCKED);
4215 sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED);
4244 } else {
4245 struct sctp_nets *netp;
4246
4247 if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) ||
4248 (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) {
4249 SCTP_STAT_DECR_GAUGE32(sctps_currestab);
4250 }
4251 SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT);

--- 206 unchanged lines hidden (view full) ---

4458 sizeof(uint32_t);
4459 ph = mtod(oper, struct sctp_paramhdr *);
4460 ph->param_type = htons(SCTP_CAUSE_PROTOCOL_VIOLATION);
4461 ph->param_length = htons(SCTP_BUF_LEN(oper));
4462 ippp = (uint32_t *) (ph + 1);
4463 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_25);
4464 }
4465 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_25;
4216 } else {
4217 struct sctp_nets *netp;
4218
4219 if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) ||
4220 (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) {
4221 SCTP_STAT_DECR_GAUGE32(sctps_currestab);
4222 }
4223 SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT);

--- 206 unchanged lines hidden (view full) ---

4430 sizeof(uint32_t);
4431 ph = mtod(oper, struct sctp_paramhdr *);
4432 ph->param_type = htons(SCTP_CAUSE_PROTOCOL_VIOLATION);
4433 ph->param_length = htons(SCTP_BUF_LEN(oper));
4434 ippp = (uint32_t *) (ph + 1);
4435 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_25);
4436 }
4437 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_25;
4466 sctp_abort_an_association(stcb->sctp_ep, stcb, SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED);
4438 sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED);
4467 return;
4468 }
4469 }
4470 /**********************/
4471 /* 1) check the range */
4472 /**********************/
4473 if (SCTP_TSN_GT(asoc->last_acked_seq, last_tsn)) {
4474 /* acking something behind */

--- 486 unchanged lines hidden (view full) ---

4961 sizeof(uint32_t);
4962 ph = mtod(oper, struct sctp_paramhdr *);
4963 ph->param_type = htons(SCTP_CAUSE_USER_INITIATED_ABT);
4964 ph->param_length = htons(SCTP_BUF_LEN(oper));
4965 ippp = (uint32_t *) (ph + 1);
4966 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_31);
4967 }
4968 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_31;
4439 return;
4440 }
4441 }
4442 /**********************/
4443 /* 1) check the range */
4444 /**********************/
4445 if (SCTP_TSN_GT(asoc->last_acked_seq, last_tsn)) {
4446 /* acking something behind */

--- 486 unchanged lines hidden (view full) ---

4933 sizeof(uint32_t);
4934 ph = mtod(oper, struct sctp_paramhdr *);
4935 ph->param_type = htons(SCTP_CAUSE_USER_INITIATED_ABT);
4936 ph->param_length = htons(SCTP_BUF_LEN(oper));
4937 ippp = (uint32_t *) (ph + 1);
4938 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_31);
4939 }
4940 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_31;
4969 sctp_abort_an_association(stcb->sctp_ep, stcb, SCTP_RESPONSE_TO_USER_REQ, oper, SCTP_SO_NOT_LOCKED);
4941 sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED);
4970 return;
4971 } else {
4972 struct sctp_nets *netp;
4973
4974 if (asoc->alternate) {
4975 netp = asoc->alternate;
4976 } else {
4977 netp = asoc->primary_destination;

--- 438 unchanged lines hidden (view full) ---

5416 ippp = (uint32_t *) (ph + 1);
5417 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_33);
5418 ippp++;
5419 *ippp = asoc->highest_tsn_inside_map;
5420 ippp++;
5421 *ippp = new_cum_tsn;
5422 }
5423 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_33;
4942 return;
4943 } else {
4944 struct sctp_nets *netp;
4945
4946 if (asoc->alternate) {
4947 netp = asoc->alternate;
4948 } else {
4949 netp = asoc->primary_destination;

--- 438 unchanged lines hidden (view full) ---

5388 ippp = (uint32_t *) (ph + 1);
5389 *ippp = htonl(SCTP_FROM_SCTP_INDATA + SCTP_LOC_33);
5390 ippp++;
5391 *ippp = asoc->highest_tsn_inside_map;
5392 ippp++;
5393 *ippp = new_cum_tsn;
5394 }
5395 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_33;
5424 sctp_abort_an_association(stcb->sctp_ep, stcb,
5425 SCTP_PEER_FAULTY, oper, SCTP_SO_NOT_LOCKED);
5396 sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED);
5426 return;
5427 }
5428 SCTP_STAT_INCR(sctps_fwdtsn_map_over);
5429
5430 memset(stcb->asoc.mapping_array, 0, stcb->asoc.mapping_array_size);
5431 asoc->mapping_array_base_tsn = new_cum_tsn + 1;
5432 asoc->highest_tsn_inside_map = new_cum_tsn;
5433

--- 177 unchanged lines hidden ---
5397 return;
5398 }
5399 SCTP_STAT_INCR(sctps_fwdtsn_map_over);
5400
5401 memset(stcb->asoc.mapping_array, 0, stcb->asoc.mapping_array_size);
5402 asoc->mapping_array_base_tsn = new_cum_tsn + 1;
5403 asoc->highest_tsn_inside_map = new_cum_tsn;
5404

--- 177 unchanged lines hidden ---