sctp_indata.c (170056) | sctp_indata.c (170091) |
---|---|
1/*- 2 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * 7 * a) Redistributions of source code must retain the above copyright notice, 8 * this list of conditions and the following disclaimer. --- 17 unchanged lines hidden (view full) --- 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 28 * THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31/* $KAME: sctp_indata.c,v 1.36 2005/03/06 16:04:17 itojun Exp $ */ 32 33#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * 7 * a) Redistributions of source code must retain the above copyright notice, 8 * this list of conditions and the following disclaimer. --- 17 unchanged lines hidden (view full) --- 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 28 * THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31/* $KAME: sctp_indata.c,v 1.36 2005/03/06 16:04:17 itojun Exp $ */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/netinet/sctp_indata.c 170056 2007-05-28 11:17:24Z rrs $"); | 34__FBSDID("$FreeBSD: head/sys/netinet/sctp_indata.c 170091 2007-05-29 09:29:03Z rrs $"); |
35 36#include <netinet/sctp_os.h> 37#include <netinet/sctp_var.h> 38#include <netinet/sctp_sysctl.h> 39#include <netinet/sctp_pcb.h> 40#include <netinet/sctp_header.h> 41#include <netinet/sctputil.h> 42#include <netinet/sctp_output.h> --- 279 unchanged lines hidden (view full) --- 322 return (NULL); 323 } 324 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_EXT_RCVINFO)) { 325 use_extended = 1; 326 len = CMSG_LEN(sizeof(struct sctp_extrcvinfo)); 327 } else { 328 len = CMSG_LEN(sizeof(struct sctp_sndrcvinfo)); 329 } | 35 36#include <netinet/sctp_os.h> 37#include <netinet/sctp_var.h> 38#include <netinet/sctp_sysctl.h> 39#include <netinet/sctp_pcb.h> 40#include <netinet/sctp_header.h> 41#include <netinet/sctputil.h> 42#include <netinet/sctp_output.h> --- 279 unchanged lines hidden (view full) --- 322 return (NULL); 323 } 324 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_EXT_RCVINFO)) { 325 use_extended = 1; 326 len = CMSG_LEN(sizeof(struct sctp_extrcvinfo)); 327 } else { 328 len = CMSG_LEN(sizeof(struct sctp_sndrcvinfo)); 329 } |
330 SCTP_MALLOC(buf, char *, len, "SCTP_CMSG"); | 330 SCTP_MALLOC(buf, char *, len, SCTP_M_CMSG); |
331 if (buf == NULL) { 332 /* No space */ 333 return (buf); 334 } 335 /* We need a CMSG header followed by the struct */ 336 cmh = (struct cmsghdr *)buf; 337 outinfo = (struct sctp_sndrcvinfo *)CMSG_DATA(cmh); 338 cmh->cmsg_level = IPPROTO_SCTP; --- 1137 unchanged lines hidden (view full) --- 1476 } else { 1477 gap = (MAX_TSN - asoc->mapping_array_base_tsn) + tsn + 1; 1478 } 1479 if (gap >= (SCTP_MAPPING_ARRAY << 3)) { 1480 /* Can't hold the bit in the mapping at max array, toss it */ 1481 return (0); 1482 } 1483 if (gap >= (uint32_t) (asoc->mapping_array_size << 3)) { | 331 if (buf == NULL) { 332 /* No space */ 333 return (buf); 334 } 335 /* We need a CMSG header followed by the struct */ 336 cmh = (struct cmsghdr *)buf; 337 outinfo = (struct sctp_sndrcvinfo *)CMSG_DATA(cmh); 338 cmh->cmsg_level = IPPROTO_SCTP; --- 1137 unchanged lines hidden (view full) --- 1476 } else { 1477 gap = (MAX_TSN - asoc->mapping_array_base_tsn) + tsn + 1; 1478 } 1479 if (gap >= (SCTP_MAPPING_ARRAY << 3)) { 1480 /* Can't hold the bit in the mapping at max array, toss it */ 1481 return (0); 1482 } 1483 if (gap >= (uint32_t) (asoc->mapping_array_size << 3)) { |
1484 SCTP_TCB_LOCK_ASSERT(stcb); |
|
1484 if (sctp_expand_mapping_array(asoc)) { 1485 /* Can't expand, drop it */ 1486 return (0); 1487 } 1488 } 1489 if (compare_with_wrap(tsn, *high_tsn, MAX_TSN)) { 1490 *high_tsn = tsn; 1491 } --- 90 unchanged lines hidden (view full) --- 1582 phdr++; 1583 /* We insert the stream in the type field */ 1584 phdr->param_type = ch->dp.stream_id; 1585 /* And set the length to 0 for the rsvd field */ 1586 phdr->param_length = 0; 1587 sctp_queue_op_err(stcb, mb); 1588 } 1589 SCTP_STAT_INCR(sctps_badsid); | 1485 if (sctp_expand_mapping_array(asoc)) { 1486 /* Can't expand, drop it */ 1487 return (0); 1488 } 1489 } 1490 if (compare_with_wrap(tsn, *high_tsn, MAX_TSN)) { 1491 *high_tsn = tsn; 1492 } --- 90 unchanged lines hidden (view full) --- 1583 phdr++; 1584 /* We insert the stream in the type field */ 1585 phdr->param_type = ch->dp.stream_id; 1586 /* And set the length to 0 for the rsvd field */ 1587 phdr->param_length = 0; 1588 sctp_queue_op_err(stcb, mb); 1589 } 1590 SCTP_STAT_INCR(sctps_badsid); |
1591 SCTP_TCB_LOCK_ASSERT(stcb); |
|
1590 SCTP_SET_TSN_PRESENT(asoc->mapping_array, gap); 1591 if (compare_with_wrap(tsn, asoc->highest_tsn_inside_map, MAX_TSN)) { 1592 /* we have a new high score */ 1593 asoc->highest_tsn_inside_map = tsn; 1594#ifdef SCTP_MAP_LOGGING 1595 sctp_log_map(0, 2, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT); 1596#endif 1597 } --- 486 unchanged lines hidden (view full) --- 2084 /* Set it present please */ 2085#ifdef SCTP_STR_LOGGING 2086 sctp_log_strm_del_alt(stcb, tsn, strmseq, strmno, SCTP_STR_LOG_FROM_MARK_TSN); 2087#endif 2088#ifdef SCTP_MAP_LOGGING 2089 sctp_log_map(asoc->mapping_array_base_tsn, asoc->cumulative_tsn, 2090 asoc->highest_tsn_inside_map, SCTP_MAP_PREPARE_SLIDE); 2091#endif | 1592 SCTP_SET_TSN_PRESENT(asoc->mapping_array, gap); 1593 if (compare_with_wrap(tsn, asoc->highest_tsn_inside_map, MAX_TSN)) { 1594 /* we have a new high score */ 1595 asoc->highest_tsn_inside_map = tsn; 1596#ifdef SCTP_MAP_LOGGING 1597 sctp_log_map(0, 2, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT); 1598#endif 1599 } --- 486 unchanged lines hidden (view full) --- 2086 /* Set it present please */ 2087#ifdef SCTP_STR_LOGGING 2088 sctp_log_strm_del_alt(stcb, tsn, strmseq, strmno, SCTP_STR_LOG_FROM_MARK_TSN); 2089#endif 2090#ifdef SCTP_MAP_LOGGING 2091 sctp_log_map(asoc->mapping_array_base_tsn, asoc->cumulative_tsn, 2092 asoc->highest_tsn_inside_map, SCTP_MAP_PREPARE_SLIDE); 2093#endif |
2094 SCTP_TCB_LOCK_ASSERT(stcb); |
|
2092 SCTP_SET_TSN_PRESENT(asoc->mapping_array, gap); 2093 /* check the special flag for stream resets */ 2094 if (((liste = TAILQ_FIRST(&asoc->resetHead)) != NULL) && 2095 ((compare_with_wrap(asoc->cumulative_tsn, liste->tsn, MAX_TSN)) || 2096 (asoc->cumulative_tsn == liste->tsn)) 2097 ) { 2098 /* 2099 * we have finished working through the backlogged TSN's now 2100 * time to reset streams. 1: call reset function. 2: free 2101 * pending_reply space 3: distribute any chunks in 2102 * pending_reply_queue. 2103 */ 2104 struct sctp_queued_to_read *ctl; 2105 2106 sctp_reset_in_stream(stcb, liste->number_entries, liste->req.list_of_streams); 2107 TAILQ_REMOVE(&asoc->resetHead, liste, next_resp); | 2095 SCTP_SET_TSN_PRESENT(asoc->mapping_array, gap); 2096 /* check the special flag for stream resets */ 2097 if (((liste = TAILQ_FIRST(&asoc->resetHead)) != NULL) && 2098 ((compare_with_wrap(asoc->cumulative_tsn, liste->tsn, MAX_TSN)) || 2099 (asoc->cumulative_tsn == liste->tsn)) 2100 ) { 2101 /* 2102 * we have finished working through the backlogged TSN's now 2103 * time to reset streams. 1: call reset function. 2: free 2104 * pending_reply space 3: distribute any chunks in 2105 * pending_reply_queue. 2106 */ 2107 struct sctp_queued_to_read *ctl; 2108 2109 sctp_reset_in_stream(stcb, liste->number_entries, liste->req.list_of_streams); 2110 TAILQ_REMOVE(&asoc->resetHead, liste, next_resp); |
2108 SCTP_FREE(liste); | 2111 SCTP_FREE(liste, SCTP_M_STRESET); |
2109 /* sa_ignore FREED_MEMORY */ 2110 liste = TAILQ_FIRST(&asoc->resetHead); 2111 ctl = TAILQ_FIRST(&asoc->pending_reply_queue); 2112 if (ctl && (liste == NULL)) { 2113 /* All can be removed */ 2114 while (ctl) { 2115 TAILQ_REMOVE(&asoc->pending_reply_queue, ctl, next); 2116 sctp_queue_data_to_stream(stcb, asoc, ctl, abort_flag); --- 3620 unchanged lines hidden (view full) --- 5737 if (asoc->highest_tsn_inside_map > 5738 asoc->mapping_array_base_tsn) { 5739 gap = asoc->highest_tsn_inside_map - 5740 asoc->mapping_array_base_tsn; 5741 } else { 5742 gap = asoc->highest_tsn_inside_map + 5743 (MAX_TSN - asoc->mapping_array_base_tsn) + 1; 5744 } | 2112 /* sa_ignore FREED_MEMORY */ 2113 liste = TAILQ_FIRST(&asoc->resetHead); 2114 ctl = TAILQ_FIRST(&asoc->pending_reply_queue); 2115 if (ctl && (liste == NULL)) { 2116 /* All can be removed */ 2117 while (ctl) { 2118 TAILQ_REMOVE(&asoc->pending_reply_queue, ctl, next); 2119 sctp_queue_data_to_stream(stcb, asoc, ctl, abort_flag); --- 3620 unchanged lines hidden (view full) --- 5740 if (asoc->highest_tsn_inside_map > 5741 asoc->mapping_array_base_tsn) { 5742 gap = asoc->highest_tsn_inside_map - 5743 asoc->mapping_array_base_tsn; 5744 } else { 5745 gap = asoc->highest_tsn_inside_map + 5746 (MAX_TSN - asoc->mapping_array_base_tsn) + 1; 5747 } |
5748 SCTP_STAT_INCR(sctps_fwdtsn_map_over); |
|
5745 cumack_set_flag = 1; 5746 } | 5749 cumack_set_flag = 1; 5750 } |
5751 SCTP_TCB_LOCK_ASSERT(stcb); |
|
5747 for (i = 0; i <= gap; i++) { 5748 SCTP_SET_TSN_PRESENT(asoc->mapping_array, i); 5749 } 5750 /* 5751 * Now after marking all, slide thing forward but no sack please. 5752 */ 5753 sctp_sack_check(stcb, 0, 0, abort_flag); 5754 if (*abort_flag) --- 177 unchanged lines hidden --- | 5752 for (i = 0; i <= gap; i++) { 5753 SCTP_SET_TSN_PRESENT(asoc->mapping_array, i); 5754 } 5755 /* 5756 * Now after marking all, slide thing forward but no sack please. 5757 */ 5758 sctp_sack_check(stcb, 0, 0, abort_flag); 5759 if (*abort_flag) --- 177 unchanged lines hidden --- |