sctp_indata.c (171088) | sctp_indata.c (171158) |
---|---|
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 171088 2007-06-29 15:14:23Z rrs $"); | 34__FBSDID("$FreeBSD: head/sys/netinet/sctp_indata.c 171158 2007-07-02 19:22:22Z 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> --- 339 unchanged lines hidden (view full) --- 382 * Lose the data pointer, since its in the socket 383 * buffer 384 */ 385 if (chk->data) { 386 sctp_m_freem(chk->data); 387 chk->data = NULL; 388 } 389 /* Now free the address and data */ | 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> --- 339 unchanged lines hidden (view full) --- 382 * Lose the data pointer, since its in the socket 383 * buffer 384 */ 385 if (chk->data) { 386 sctp_m_freem(chk->data); 387 chk->data = NULL; 388 } 389 /* Now free the address and data */ |
390 sctp_free_remote_addr(chk->whoTo); | |
391 sctp_free_a_chunk(stcb, chk); 392 /* sa_ignore FREED_MEMORY */ 393 chk = TAILQ_FIRST(&asoc->reasmqueue); 394 } 395 return; 396 } 397 SCTP_TCB_LOCK_ASSERT(stcb); 398 do { --- 77 unchanged lines hidden (view full) --- 476 asoc->last_strm_seq_delivered = chk->rec.data.stream_seq; 477 asoc->last_strm_no_delivered = chk->rec.data.stream_number; 478 479 asoc->tsn_last_delivered = chk->rec.data.TSN_seq; 480 asoc->size_on_reasm_queue -= chk->send_size; 481 sctp_ucount_decr(asoc->cnt_on_reasm_queue); 482 /* free up the chk */ 483 chk->data = NULL; | 390 sctp_free_a_chunk(stcb, chk); 391 /* sa_ignore FREED_MEMORY */ 392 chk = TAILQ_FIRST(&asoc->reasmqueue); 393 } 394 return; 395 } 396 SCTP_TCB_LOCK_ASSERT(stcb); 397 do { --- 77 unchanged lines hidden (view full) --- 475 asoc->last_strm_seq_delivered = chk->rec.data.stream_seq; 476 asoc->last_strm_no_delivered = chk->rec.data.stream_number; 477 478 asoc->tsn_last_delivered = chk->rec.data.TSN_seq; 479 asoc->size_on_reasm_queue -= chk->send_size; 480 sctp_ucount_decr(asoc->cnt_on_reasm_queue); 481 /* free up the chk */ 482 chk->data = NULL; |
484 sctp_free_remote_addr(chk->whoTo); | |
485 sctp_free_a_chunk(stcb, chk); 486 487 if (asoc->fragmented_delivery_inprogress == 0) { 488 /* 489 * Now lets see if we can deliver the next one on 490 * the stream 491 */ 492 struct sctp_stream_in *strm; --- 192 unchanged lines hidden (view full) --- 685 * away the chunk! 686 */ 687 688 if (control->data) 689 sctp_m_freem(control->data); 690 control->data = NULL; 691 asoc->size_on_all_streams -= control->length; 692 sctp_ucount_decr(asoc->cnt_on_all_streams); | 483 sctp_free_a_chunk(stcb, chk); 484 485 if (asoc->fragmented_delivery_inprogress == 0) { 486 /* 487 * Now lets see if we can deliver the next one on 488 * the stream 489 */ 490 struct sctp_stream_in *strm; --- 192 unchanged lines hidden (view full) --- 683 * away the chunk! 684 */ 685 686 if (control->data) 687 sctp_m_freem(control->data); 688 control->data = NULL; 689 asoc->size_on_all_streams -= control->length; 690 sctp_ucount_decr(asoc->cnt_on_all_streams); |
693 sctp_free_remote_addr(control->whoFrom); | 691 if (control->whoFrom) 692 sctp_free_remote_addr(control->whoFrom); 693 control->whoFrom = NULL; |
694 sctp_free_a_readq(stcb, control); 695 return; 696 } else { 697 if (TAILQ_NEXT(at, next) == NULL) { 698 /* 699 * We are at the end, insert 700 * it after this one 701 */ --- 302 unchanged lines hidden (view full) --- 1004 * that the SSN's have wrapped. Maybe I should 1005 * compare to TSN somehow... sigh for now just blow 1006 * away the chunk! 1007 */ 1008 if (chk->data) { 1009 sctp_m_freem(chk->data); 1010 chk->data = NULL; 1011 } | 694 sctp_free_a_readq(stcb, control); 695 return; 696 } else { 697 if (TAILQ_NEXT(at, next) == NULL) { 698 /* 699 * We are at the end, insert 700 * it after this one 701 */ --- 302 unchanged lines hidden (view full) --- 1004 * that the SSN's have wrapped. Maybe I should 1005 * compare to TSN somehow... sigh for now just blow 1006 * away the chunk! 1007 */ 1008 if (chk->data) { 1009 sctp_m_freem(chk->data); 1010 chk->data = NULL; 1011 } |
1012 sctp_free_remote_addr(chk->whoTo); | |
1013 sctp_free_a_chunk(stcb, chk); 1014 return; 1015 } else { 1016 last_flags = at->rec.data.rcv_flags; 1017 last_tsn = at->rec.data.TSN_seq; 1018 prev = at; 1019 if (TAILQ_NEXT(at, sctp_next) == NULL) { 1020 /* --- 850 unchanged lines hidden (view full) --- 1871 uint32_t estimate_tsn; 1872 1873 estimate_tsn = asoc->tsn_last_delivered + 1; 1874 if (TAILQ_EMPTY(&asoc->reasmqueue) && 1875 (estimate_tsn == control->sinfo_tsn)) { 1876 /* Evil/Broke peer */ 1877 sctp_m_freem(control->data); 1878 control->data = NULL; | 1012 sctp_free_a_chunk(stcb, chk); 1013 return; 1014 } else { 1015 last_flags = at->rec.data.rcv_flags; 1016 last_tsn = at->rec.data.TSN_seq; 1017 prev = at; 1018 if (TAILQ_NEXT(at, sctp_next) == NULL) { 1019 /* --- 850 unchanged lines hidden (view full) --- 1870 uint32_t estimate_tsn; 1871 1872 estimate_tsn = asoc->tsn_last_delivered + 1; 1873 if (TAILQ_EMPTY(&asoc->reasmqueue) && 1874 (estimate_tsn == control->sinfo_tsn)) { 1875 /* Evil/Broke peer */ 1876 sctp_m_freem(control->data); 1877 control->data = NULL; |
1879 sctp_free_remote_addr(control->whoFrom); | 1878 if (control->whoFrom) { 1879 sctp_free_remote_addr(control->whoFrom); 1880 control->whoFrom = NULL; 1881 } |
1880 sctp_free_a_readq(stcb, control); 1881 oper = sctp_get_mbuf_for_msg((sizeof(struct sctp_paramhdr) + 3 * sizeof(uint32_t)), 1882 0, M_DONTWAIT, 1, MT_DATA); 1883 if (oper) { 1884 struct sctp_paramhdr *ph; 1885 uint32_t *ippp; 1886 1887 SCTP_BUF_LEN(oper) = --- 15 unchanged lines hidden (view full) --- 1903 SCTP_PEER_FAULTY, oper); 1904 1905 *abort_flag = 1; 1906 return (0); 1907 } else { 1908 if (sctp_does_tsn_belong_to_reasm(asoc, control->sinfo_tsn)) { 1909 sctp_m_freem(control->data); 1910 control->data = NULL; | 1882 sctp_free_a_readq(stcb, control); 1883 oper = sctp_get_mbuf_for_msg((sizeof(struct sctp_paramhdr) + 3 * sizeof(uint32_t)), 1884 0, M_DONTWAIT, 1, MT_DATA); 1885 if (oper) { 1886 struct sctp_paramhdr *ph; 1887 uint32_t *ippp; 1888 1889 SCTP_BUF_LEN(oper) = --- 15 unchanged lines hidden (view full) --- 1905 SCTP_PEER_FAULTY, oper); 1906 1907 *abort_flag = 1; 1908 return (0); 1909 } else { 1910 if (sctp_does_tsn_belong_to_reasm(asoc, control->sinfo_tsn)) { 1911 sctp_m_freem(control->data); 1912 control->data = NULL; |
1911 sctp_free_remote_addr(control->whoFrom); | 1913 if (control->whoFrom) { 1914 sctp_free_remote_addr(control->whoFrom); 1915 control->whoFrom = NULL; 1916 } |
1912 sctp_free_a_readq(stcb, control); 1913 1914 oper = sctp_get_mbuf_for_msg((sizeof(struct sctp_paramhdr) + 3 * sizeof(uint32_t)), 1915 0, M_DONTWAIT, 1, MT_DATA); 1916 if (oper) { 1917 struct sctp_paramhdr *ph; 1918 uint32_t *ippp; 1919 --- 28 unchanged lines hidden (view full) --- 1948 * Reassembly queue is NOT empty validate 1949 * that this tsn does not need to be in 1950 * reasembly queue. If it does then our peer 1951 * is broken or evil. 1952 */ 1953 if (sctp_does_tsn_belong_to_reasm(asoc, control->sinfo_tsn)) { 1954 sctp_m_freem(control->data); 1955 control->data = NULL; | 1917 sctp_free_a_readq(stcb, control); 1918 1919 oper = sctp_get_mbuf_for_msg((sizeof(struct sctp_paramhdr) + 3 * sizeof(uint32_t)), 1920 0, M_DONTWAIT, 1, MT_DATA); 1921 if (oper) { 1922 struct sctp_paramhdr *ph; 1923 uint32_t *ippp; 1924 --- 28 unchanged lines hidden (view full) --- 1953 * Reassembly queue is NOT empty validate 1954 * that this tsn does not need to be in 1955 * reasembly queue. If it does then our peer 1956 * is broken or evil. 1957 */ 1958 if (sctp_does_tsn_belong_to_reasm(asoc, control->sinfo_tsn)) { 1959 sctp_m_freem(control->data); 1960 control->data = NULL; |
1956 sctp_free_remote_addr(control->whoFrom); | 1961 if (control->whoFrom) { 1962 sctp_free_remote_addr(control->whoFrom); 1963 control->whoFrom = NULL; 1964 } |
1957 sctp_free_a_readq(stcb, control); 1958 oper = sctp_get_mbuf_for_msg((sizeof(struct sctp_paramhdr) + 3 * sizeof(uint32_t)), 1959 0, M_DONTWAIT, 1, MT_DATA); 1960 if (oper) { 1961 struct sctp_paramhdr *ph; 1962 uint32_t *ippp; 1963 1964 SCTP_BUF_LEN(oper) = --- 2348 unchanged lines hidden (view full) --- 4313 cumack, 4314 tp1->rec.data.TSN_seq, 4315 0, 4316 0, 4317 SCTP_LOG_FREE_SENT); 4318 } 4319 tp1->data = NULL; 4320 asoc->sent_queue_cnt--; | 1965 sctp_free_a_readq(stcb, control); 1966 oper = sctp_get_mbuf_for_msg((sizeof(struct sctp_paramhdr) + 3 * sizeof(uint32_t)), 1967 0, M_DONTWAIT, 1, MT_DATA); 1968 if (oper) { 1969 struct sctp_paramhdr *ph; 1970 uint32_t *ippp; 1971 1972 SCTP_BUF_LEN(oper) = --- 2348 unchanged lines hidden (view full) --- 4321 cumack, 4322 tp1->rec.data.TSN_seq, 4323 0, 4324 0, 4325 SCTP_LOG_FREE_SENT); 4326 } 4327 tp1->data = NULL; 4328 asoc->sent_queue_cnt--; |
4321 sctp_free_remote_addr(tp1->whoTo); | |
4322 sctp_free_a_chunk(stcb, tp1); 4323 tp1 = tp2; 4324 } 4325 } 4326 if (stcb->sctp_socket) { 4327 SOCKBUF_LOCK(&stcb->sctp_socket->so_snd); 4328 if (sctp_logging_level & SCTP_WAKE_LOGGING_ENABLE) { 4329 sctp_wakeup_log(stcb, cumack, 1, SCTP_WAKESND_FROM_SACK); --- 694 unchanged lines hidden (view full) --- 5024 cum_ack, 5025 tp1->rec.data.TSN_seq, 5026 0, 5027 0, 5028 SCTP_LOG_FREE_SENT); 5029 } 5030 tp1->data = NULL; 5031 asoc->sent_queue_cnt--; | 4329 sctp_free_a_chunk(stcb, tp1); 4330 tp1 = tp2; 4331 } 4332 } 4333 if (stcb->sctp_socket) { 4334 SOCKBUF_LOCK(&stcb->sctp_socket->so_snd); 4335 if (sctp_logging_level & SCTP_WAKE_LOGGING_ENABLE) { 4336 sctp_wakeup_log(stcb, cumack, 1, SCTP_WAKESND_FROM_SACK); --- 694 unchanged lines hidden (view full) --- 5031 cum_ack, 5032 tp1->rec.data.TSN_seq, 5033 0, 5034 0, 5035 SCTP_LOG_FREE_SENT); 5036 } 5037 tp1->data = NULL; 5038 asoc->sent_queue_cnt--; |
5032 sctp_free_remote_addr(tp1->whoTo); 5033 | |
5034 sctp_free_a_chunk(stcb, tp1); 5035 wake_him++; 5036 tp1 = tp2; 5037 } while (tp1 != NULL); 5038 5039done_with_it: 5040 if ((wake_him) && (stcb->sctp_socket)) { 5041 SOCKBUF_LOCK(&stcb->sctp_socket->so_snd); --- 778 unchanged lines hidden (view full) --- 5820 */ 5821 asoc->strmin[chk->rec.data.stream_number].last_sequence_delivered = 5822 chk->rec.data.stream_seq; 5823 } 5824 if (chk->data) { 5825 sctp_m_freem(chk->data); 5826 chk->data = NULL; 5827 } | 5039 sctp_free_a_chunk(stcb, tp1); 5040 wake_him++; 5041 tp1 = tp2; 5042 } while (tp1 != NULL); 5043 5044done_with_it: 5045 if ((wake_him) && (stcb->sctp_socket)) { 5046 SOCKBUF_LOCK(&stcb->sctp_socket->so_snd); --- 778 unchanged lines hidden (view full) --- 5825 */ 5826 asoc->strmin[chk->rec.data.stream_number].last_sequence_delivered = 5827 chk->rec.data.stream_seq; 5828 } 5829 if (chk->data) { 5830 sctp_m_freem(chk->data); 5831 chk->data = NULL; 5832 } |
5828 sctp_free_remote_addr(chk->whoTo); | |
5829 sctp_free_a_chunk(stcb, chk); 5830 } else { 5831 /* 5832 * Ok we have gone beyond the end of the 5833 * fwd-tsn's mark. Some checks... 5834 */ 5835 if ((asoc->fragmented_delivery_inprogress) && 5836 (chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG)) { --- 86 unchanged lines hidden --- | 5833 sctp_free_a_chunk(stcb, chk); 5834 } else { 5835 /* 5836 * Ok we have gone beyond the end of the 5837 * fwd-tsn's mark. Some checks... 5838 */ 5839 if ((asoc->fragmented_delivery_inprogress) && 5840 (chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG)) { --- 86 unchanged lines hidden --- |