sctp_input.c (163979) | sctp_input.c (163996) |
---|---|
1/*- 2 * Copyright (c) 2001-2006, 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_input.c,v 1.27 2005/03/06 16:04:17 itojun Exp $ */ 32 33#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001-2006, 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_input.c,v 1.27 2005/03/06 16:04:17 itojun Exp $ */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/netinet/sctp_input.c 163979 2006-11-04 08:19:01Z ru $"); | 34__FBSDID("$FreeBSD: head/sys/netinet/sctp_input.c 163996 2006-11-05 13:25:18Z rrs $"); |
35 36#include "opt_ipsec.h" 37#include "opt_compat.h" 38#include "opt_inet6.h" 39#include "opt_inet.h" 40#include "opt_sctp.h" 41 42#include <sys/param.h> --- 539 unchanged lines hidden (view full) --- 582 */ 583 SCTP_INP_READ_LOCK(stcb->sctp_ep); 584 stcb->asoc.control_pdapi->end_added = 1; 585 if (stcb->asoc.control_pdapi->tail_mbuf) { 586 stcb->asoc.control_pdapi->tail_mbuf->m_flags |= M_EOR; 587 } 588 stcb->asoc.control_pdapi = NULL; 589 SCTP_INP_READ_UNLOCK(stcb->sctp_ep); | 35 36#include "opt_ipsec.h" 37#include "opt_compat.h" 38#include "opt_inet6.h" 39#include "opt_inet.h" 40#include "opt_sctp.h" 41 42#include <sys/param.h> --- 539 unchanged lines hidden (view full) --- 582 */ 583 SCTP_INP_READ_LOCK(stcb->sctp_ep); 584 stcb->asoc.control_pdapi->end_added = 1; 585 if (stcb->asoc.control_pdapi->tail_mbuf) { 586 stcb->asoc.control_pdapi->tail_mbuf->m_flags |= M_EOR; 587 } 588 stcb->asoc.control_pdapi = NULL; 589 SCTP_INP_READ_UNLOCK(stcb->sctp_ep); |
590 sctp_sorwakeup(stcb->sctp_ep, stcb->sctp_socket); |
|
590 } 591 /* goto SHUTDOWN_RECEIVED state to block new requests */ 592 if (stcb->sctp_socket) { 593 if ((SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_RECEIVED) && 594 (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_SENT)) { 595 asoc->state = SCTP_STATE_SHUTDOWN_RECEIVED; 596 /* 597 * notify upper layer that peer has initiated a --- 74 unchanged lines hidden (view full) --- 672 */ 673 SCTP_INP_READ_LOCK(stcb->sctp_ep); 674 stcb->asoc.control_pdapi->end_added = 1; 675 if (stcb->asoc.control_pdapi->tail_mbuf) { 676 stcb->asoc.control_pdapi->tail_mbuf->m_flags |= M_EOR; 677 } 678 stcb->asoc.control_pdapi = NULL; 679 SCTP_INP_READ_UNLOCK(stcb->sctp_ep); | 591 } 592 /* goto SHUTDOWN_RECEIVED state to block new requests */ 593 if (stcb->sctp_socket) { 594 if ((SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_RECEIVED) && 595 (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_SENT)) { 596 asoc->state = SCTP_STATE_SHUTDOWN_RECEIVED; 597 /* 598 * notify upper layer that peer has initiated a --- 74 unchanged lines hidden (view full) --- 673 */ 674 SCTP_INP_READ_LOCK(stcb->sctp_ep); 675 stcb->asoc.control_pdapi->end_added = 1; 676 if (stcb->asoc.control_pdapi->tail_mbuf) { 677 stcb->asoc.control_pdapi->tail_mbuf->m_flags |= M_EOR; 678 } 679 stcb->asoc.control_pdapi = NULL; 680 SCTP_INP_READ_UNLOCK(stcb->sctp_ep); |
681 sctp_sorwakeup(stcb->sctp_ep, stcb->sctp_socket); |
|
680 } 681 /* are the queues empty? */ 682 if (!TAILQ_EMPTY(&asoc->send_queue) || 683 !TAILQ_EMPTY(&asoc->sent_queue) || 684 !TAILQ_EMPTY(&asoc->out_wheel)) { 685 sctp_report_all_outbound(stcb); 686 } 687 /* stop the timer */ --- 3621 unchanged lines hidden (view full) --- 4309 SCTP_STAT_INCR(sctps_recvdatagrams); 4310#ifdef SCTP_AUDITING_ENABLED 4311 sctp_audit_log(0xE0, 1); 4312 sctp_auditing(0, inp, stcb, net); 4313#endif 4314 4315#ifdef SCTP_DEBUG 4316 if (sctp_debug_on & SCTP_DEBUG_INPUT1) { | 682 } 683 /* are the queues empty? */ 684 if (!TAILQ_EMPTY(&asoc->send_queue) || 685 !TAILQ_EMPTY(&asoc->sent_queue) || 686 !TAILQ_EMPTY(&asoc->out_wheel)) { 687 sctp_report_all_outbound(stcb); 688 } 689 /* stop the timer */ --- 3621 unchanged lines hidden (view full) --- 4311 SCTP_STAT_INCR(sctps_recvdatagrams); 4312#ifdef SCTP_AUDITING_ENABLED 4313 sctp_audit_log(0xE0, 1); 4314 sctp_auditing(0, inp, stcb, net); 4315#endif 4316 4317#ifdef SCTP_DEBUG 4318 if (sctp_debug_on & SCTP_DEBUG_INPUT1) { |
4317 printf("Ok, Common input processing called, m:%x iphlen:%d offset:%d\n", 4318 (uint32_t) m, iphlen, offset); | 4319 printf("Ok, Common input processing called, m:%p iphlen:%d offset:%d\n", 4320 m, iphlen, offset); |
4319 } 4320#endif /* SCTP_DEBUG */ 4321 4322 if (stcb) { 4323 /* always clear this before beginning a packet */ 4324 stcb->asoc.authenticated = 0; 4325 stcb->asoc.seen_a_sack_this_pkt = 0; 4326 } --- 292 unchanged lines hidden (view full) --- 4619 if (ip->ip_src.s_addr == ip->ip_dst.s_addr) 4620 goto sctp_skip_csum_4; 4621 } 4622 sh->checksum = 0; /* prepare for calc */ 4623 calc_check = sctp_calculate_sum(m, &mlen, iphlen); 4624 if (calc_check != check) { 4625#ifdef SCTP_DEBUG 4626 if (sctp_debug_on & SCTP_DEBUG_INPUT1) { | 4321 } 4322#endif /* SCTP_DEBUG */ 4323 4324 if (stcb) { 4325 /* always clear this before beginning a packet */ 4326 stcb->asoc.authenticated = 0; 4327 stcb->asoc.seen_a_sack_this_pkt = 0; 4328 } --- 292 unchanged lines hidden (view full) --- 4621 if (ip->ip_src.s_addr == ip->ip_dst.s_addr) 4622 goto sctp_skip_csum_4; 4623 } 4624 sh->checksum = 0; /* prepare for calc */ 4625 calc_check = sctp_calculate_sum(m, &mlen, iphlen); 4626 if (calc_check != check) { 4627#ifdef SCTP_DEBUG 4628 if (sctp_debug_on & SCTP_DEBUG_INPUT1) { |
4627 printf("Bad CSUM on SCTP packet calc_check:%x check:%x m:%x mlen:%d iphlen:%d\n", 4628 calc_check, check, (uint32_t) m, mlen, iphlen); | 4629 printf("Bad CSUM on SCTP packet calc_check:%x check:%x m:%p mlen:%d iphlen:%d\n", 4630 calc_check, check, m, mlen, iphlen); |
4629 } 4630#endif 4631 4632 stcb = sctp_findassociation_addr(m, iphlen, 4633 offset - sizeof(*ch), 4634 sh, ch, &inp, &net); 4635 if ((inp) && (stcb)) { 4636 sctp_send_packet_dropped(stcb, net, m, iphlen, 1); --- 58 unchanged lines hidden (view full) --- 4695 refcount_up = 1; 4696 } 4697#ifdef IPSEC 4698 /* 4699 * I very much doubt any of the IPSEC stuff will work but I have no 4700 * idea, so I will leave it in place. 4701 */ 4702 | 4631 } 4632#endif 4633 4634 stcb = sctp_findassociation_addr(m, iphlen, 4635 offset - sizeof(*ch), 4636 sh, ch, &inp, &net); 4637 if ((inp) && (stcb)) { 4638 sctp_send_packet_dropped(stcb, net, m, iphlen, 1); --- 58 unchanged lines hidden (view full) --- 4697 refcount_up = 1; 4698 } 4699#ifdef IPSEC 4700 /* 4701 * I very much doubt any of the IPSEC stuff will work but I have no 4702 * idea, so I will leave it in place. 4703 */ 4704 |
4703 if (ipsec4_in_reject_so(m, inp->ip_inp.inp.inp_socket)) { | 4705 if (inp && ipsec4_in_reject(m, &inp->ip_inp.inp)) { |
4704 ipsecstat.in_polvio++; 4705 SCTP_STAT_INCR(sctps_hdrops); 4706 goto bad; 4707 } 4708#endif /* IPSEC */ 4709 4710 4711 --- 38 unchanged lines hidden --- | 4706 ipsecstat.in_polvio++; 4707 SCTP_STAT_INCR(sctps_hdrops); 4708 goto bad; 4709 } 4710#endif /* IPSEC */ 4711 4712 4713 --- 38 unchanged lines hidden --- |