Deleted Added
full compact
sctp6_usrreq.c (170091) sctp6_usrreq.c (170181)
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.

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

24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
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/* $KAME: sctp6_usrreq.c,v 1.38 2005/08/24 08:08:56 suz Exp $ */
31#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.

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

24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
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/* $KAME: sctp6_usrreq.c,v 1.38 2005/08/24 08:08:56 suz Exp $ */
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sys/netinet6/sctp6_usrreq.c 170091 2007-05-29 09:29:03Z rrs $");
32__FBSDID("$FreeBSD: head/sys/netinet6/sctp6_usrreq.c 170181 2007-06-01 11:19:54Z rrs $");
33
34
35#include <netinet/sctp_os.h>
36#include <sys/proc.h>
37#include <netinet/sctp_pcb.h>
38#include <netinet/sctp_header.h>
39#include <netinet/sctp_var.h>
40#if defined(INET6)

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

66{
67 struct mbuf *m;
68 struct ip6_hdr *ip6;
69 struct sctphdr *sh;
70 struct sctp_inpcb *in6p = NULL;
71 struct sctp_nets *net;
72 int refcount_up = 0;
73 uint32_t check, calc_check;
33
34
35#include <netinet/sctp_os.h>
36#include <sys/proc.h>
37#include <netinet/sctp_pcb.h>
38#include <netinet/sctp_header.h>
39#include <netinet/sctp_var.h>
40#if defined(INET6)

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

66{
67 struct mbuf *m;
68 struct ip6_hdr *ip6;
69 struct sctphdr *sh;
70 struct sctp_inpcb *in6p = NULL;
71 struct sctp_nets *net;
72 int refcount_up = 0;
73 uint32_t check, calc_check;
74 uint32_t vrf_id = 0, table_id = 0;
74 uint32_t vrf_id = 0;
75 struct inpcb *in6p_ip;
76 struct sctp_chunkhdr *ch;
77 int length, mlen, offset, iphlen;
78 uint8_t ecn_bits;
79 struct sctp_tcb *stcb = NULL;
80 int pkt_len = 0;
81 int off = *offp;
82
83 /* get the VRF and table id's */
84 if (SCTP_GET_PKT_VRFID(*i_pak, vrf_id)) {
85 SCTP_RELEASE_PKT(*i_pak);
86 return (-1);
87 }
75 struct inpcb *in6p_ip;
76 struct sctp_chunkhdr *ch;
77 int length, mlen, offset, iphlen;
78 uint8_t ecn_bits;
79 struct sctp_tcb *stcb = NULL;
80 int pkt_len = 0;
81 int off = *offp;
82
83 /* get the VRF and table id's */
84 if (SCTP_GET_PKT_VRFID(*i_pak, vrf_id)) {
85 SCTP_RELEASE_PKT(*i_pak);
86 return (-1);
87 }
88 if (SCTP_GET_PKT_TABLEID(*i_pak, table_id)) {
89 SCTP_RELEASE_PKT(*i_pak);
90 return (-1);
91 }
92 m = SCTP_HEADER_TO_CHAIN(*i_pak);
93 pkt_len = SCTP_HEADER_LEN((*i_pak));
94
95#ifdef SCTP_PACKET_LOGGING
96 sctp_packet_log(m, pkt_len);
97#endif
98 ip6 = mtod(m, struct ip6_hdr *);
99 /* Ensure that (sctphdr + sctp_chunkhdr) in a row. */

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

184 iphlen + sizeof(*sh), sizeof(*init_chk),
185 (uint8_t *) & chunk_buf);
186 if (init_chk)
187 sh->v_tag = init_chk->init.initiate_tag;
188 else
189 sh->v_tag = 0;
190 }
191 if (ch->chunk_type == SCTP_SHUTDOWN_ACK) {
88 m = SCTP_HEADER_TO_CHAIN(*i_pak);
89 pkt_len = SCTP_HEADER_LEN((*i_pak));
90
91#ifdef SCTP_PACKET_LOGGING
92 sctp_packet_log(m, pkt_len);
93#endif
94 ip6 = mtod(m, struct ip6_hdr *);
95 /* Ensure that (sctphdr + sctp_chunkhdr) in a row. */

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

180 iphlen + sizeof(*sh), sizeof(*init_chk),
181 (uint8_t *) & chunk_buf);
182 if (init_chk)
183 sh->v_tag = init_chk->init.initiate_tag;
184 else
185 sh->v_tag = 0;
186 }
187 if (ch->chunk_type == SCTP_SHUTDOWN_ACK) {
192 sctp_send_shutdown_complete2(m, iphlen, sh, vrf_id,
193 table_id);
188 sctp_send_shutdown_complete2(m, iphlen, sh, vrf_id);
194 goto bad;
195 }
196 if (ch->chunk_type == SCTP_SHUTDOWN_COMPLETE) {
197 goto bad;
198 }
199 if (ch->chunk_type != SCTP_ABORT_ASSOCIATION)
189 goto bad;
190 }
191 if (ch->chunk_type == SCTP_SHUTDOWN_COMPLETE) {
192 goto bad;
193 }
194 if (ch->chunk_type != SCTP_ABORT_ASSOCIATION)
200 sctp_send_abort(m, iphlen, sh, 0, NULL, vrf_id,
201 table_id);
195 sctp_send_abort(m, iphlen, sh, 0, NULL, vrf_id);
202 goto bad;
203 } else if (stcb == NULL) {
204 refcount_up = 1;
205 }
206 in6p_ip = (struct inpcb *)in6p;
207#ifdef IPSEC
208 /*
209 * Check AH/ESP integrity.

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

221 offset -= sizeof(*ch);
222 ecn_bits = ((ntohl(ip6->ip6_flow) >> 20) & 0x000000ff);
223
224 /* Length now holds the total packet length payload + iphlen */
225 length = ntohs(ip6->ip6_plen) + iphlen;
226
227 /* sa_ignore NO_NULL_CHK */
228 sctp_common_input_processing(&m, iphlen, offset, length, sh, ch,
196 goto bad;
197 } else if (stcb == NULL) {
198 refcount_up = 1;
199 }
200 in6p_ip = (struct inpcb *)in6p;
201#ifdef IPSEC
202 /*
203 * Check AH/ESP integrity.

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

215 offset -= sizeof(*ch);
216 ecn_bits = ((ntohl(ip6->ip6_flow) >> 20) & 0x000000ff);
217
218 /* Length now holds the total packet length payload + iphlen */
219 length = ntohs(ip6->ip6_plen) + iphlen;
220
221 /* sa_ignore NO_NULL_CHK */
222 sctp_common_input_processing(&m, iphlen, offset, length, sh, ch,
229 in6p, stcb, net, ecn_bits, vrf_id, table_id);
223 in6p, stcb, net, ecn_bits, vrf_id);
230 /* inp's ref-count reduced && stcb unlocked */
231 /* XXX this stuff below gets moved to appropriate parts later... */
232 if (m)
233 sctp_m_freem(m);
234 if ((in6p) && refcount_up) {
235 /* reduce ref-count */
236 SCTP_INP_WLOCK(in6p);
237 SCTP_INP_DECR_REF(in6p);

--- 1069 unchanged lines hidden ---
224 /* inp's ref-count reduced && stcb unlocked */
225 /* XXX this stuff below gets moved to appropriate parts later... */
226 if (m)
227 sctp_m_freem(m);
228 if ((in6p) && refcount_up) {
229 /* reduce ref-count */
230 SCTP_INP_WLOCK(in6p);
231 SCTP_INP_DECR_REF(in6p);

--- 1069 unchanged lines hidden ---