sctp_usrreq.c (235091) | sctp_usrreq.c (235360) |
---|---|
1/*- 2 * Copyright (c) 2001-2008, 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_usrreq.c,v 1.48 2005/03/07 23:26:08 itojun Exp $ */ 34 35#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001-2008, 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_usrreq.c,v 1.48 2005/03/07 23:26:08 itojun Exp $ */ 34 35#include <sys/cdefs.h> |
36__FBSDID("$FreeBSD: head/sys/netinet/sctp_usrreq.c 235091 2012-05-06 14:50:54Z tuexen $"); | 36__FBSDID("$FreeBSD: head/sys/netinet/sctp_usrreq.c 235360 2012-05-12 20:11:35Z tuexen $"); |
37#include <netinet/sctp_os.h> 38#include <sys/proc.h> 39#include <netinet/sctp_pcb.h> 40#include <netinet/sctp_header.h> 41#include <netinet/sctp_var.h> 42#if defined(INET6) 43#endif 44#include <netinet/sctp_sysctl.h> --- 179 unchanged lines hidden (view full) --- 224 struct sockaddr *to, 225 struct sctp_tcb *stcb, 226 struct sctp_nets *net) 227{ 228#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) 229 struct socket *so; 230 231#endif | 37#include <netinet/sctp_os.h> 38#include <sys/proc.h> 39#include <netinet/sctp_pcb.h> 40#include <netinet/sctp_header.h> 41#include <netinet/sctp_var.h> 42#if defined(INET6) 43#endif 44#include <netinet/sctp_sysctl.h> --- 179 unchanged lines hidden (view full) --- 224 struct sockaddr *to, 225 struct sctp_tcb *stcb, 226 struct sctp_nets *net) 227{ 228#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) 229 struct socket *so; 230 231#endif |
232 /* protection */ 233 int reason; | |
234 struct icmp *icmph; 235 | 232 struct icmp *icmph; 233 |
236 | 234 /* protection */ |
237 if ((inp == NULL) || (stcb == NULL) || (net == NULL) || 238 (sh == NULL) || (to == NULL)) { 239 if (stcb) 240 SCTP_TCB_UNLOCK(stcb); 241 return; 242 } 243 /* First job is to verify the vtag matches what I would send */ 244 if (ntohl(sh->v_tag) != (stcb->asoc.peer_vtag)) { --- 35 unchanged lines hidden (view full) --- 280 (icmph->icmp_code == ICMP_UNREACH_PORT)) { 281 /* 282 * Here the peer is either playing tricks on us, including 283 * an address that belongs to someone who does not support 284 * SCTP OR was a userland implementation that shutdown and 285 * now is dead. In either case treat it like a OOTB abort 286 * with no TCB 287 */ | 235 if ((inp == NULL) || (stcb == NULL) || (net == NULL) || 236 (sh == NULL) || (to == NULL)) { 237 if (stcb) 238 SCTP_TCB_UNLOCK(stcb); 239 return; 240 } 241 /* First job is to verify the vtag matches what I would send */ 242 if (ntohl(sh->v_tag) != (stcb->asoc.peer_vtag)) { --- 35 unchanged lines hidden (view full) --- 278 (icmph->icmp_code == ICMP_UNREACH_PORT)) { 279 /* 280 * Here the peer is either playing tricks on us, including 281 * an address that belongs to someone who does not support 282 * SCTP OR was a userland implementation that shutdown and 283 * now is dead. In either case treat it like a OOTB abort 284 * with no TCB 285 */ |
288 reason = SCTP_PEER_FAULTY; 289 sctp_abort_notification(stcb, reason, SCTP_SO_NOT_LOCKED); | 286 sctp_abort_notification(stcb, 0, NULL, SCTP_SO_NOT_LOCKED); |
290#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) 291 so = SCTP_INP_SO(inp); 292 atomic_add_int(&stcb->asoc.refcnt, 1); 293 SCTP_TCB_UNLOCK(stcb); 294 SCTP_SOCKET_LOCK(so, 1); 295 SCTP_TCB_LOCK(stcb); 296 atomic_subtract_int(&stcb->asoc.refcnt, 1); 297#endif --- 795 unchanged lines hidden (view full) --- 1093 ph->param_type = htons( 1094 SCTP_CAUSE_USER_INITIATED_ABT); 1095 ph->param_length = htons(SCTP_BUF_LEN(op_err)); 1096 ippp = (uint32_t *) (ph + 1); 1097 *ippp = htonl(SCTP_FROM_SCTP_USRREQ + SCTP_LOC_6); 1098 } 1099 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_USRREQ + SCTP_LOC_6; 1100 sctp_abort_an_association(stcb->sctp_ep, stcb, | 287#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) 288 so = SCTP_INP_SO(inp); 289 atomic_add_int(&stcb->asoc.refcnt, 1); 290 SCTP_TCB_UNLOCK(stcb); 291 SCTP_SOCKET_LOCK(so, 1); 292 SCTP_TCB_LOCK(stcb); 293 atomic_subtract_int(&stcb->asoc.refcnt, 1); 294#endif --- 795 unchanged lines hidden (view full) --- 1090 ph->param_type = htons( 1091 SCTP_CAUSE_USER_INITIATED_ABT); 1092 ph->param_length = htons(SCTP_BUF_LEN(op_err)); 1093 ippp = (uint32_t *) (ph + 1); 1094 *ippp = htonl(SCTP_FROM_SCTP_USRREQ + SCTP_LOC_6); 1095 } 1096 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_USRREQ + SCTP_LOC_6; 1097 sctp_abort_an_association(stcb->sctp_ep, stcb, |
1101 SCTP_RESPONSE_TO_USER_REQ, | |
1102 op_err, SCTP_SO_LOCKED); 1103 goto skip_unlock; 1104 } else { 1105 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_CLOSING, SCTP_SO_LOCKED); 1106 } 1107 } 1108 SCTP_TCB_UNLOCK(stcb); 1109 } --- 5398 unchanged lines hidden --- | 1098 op_err, SCTP_SO_LOCKED); 1099 goto skip_unlock; 1100 } else { 1101 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_CLOSING, SCTP_SO_LOCKED); 1102 } 1103 } 1104 SCTP_TCB_UNLOCK(stcb); 1105 } --- 5398 unchanged lines hidden --- |