Deleted Added
full compact
sctputil.c (164181) sctputil.c (164205)
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: sctputil.c,v 1.37 2005/03/07 23:26:09 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: sctputil.c,v 1.37 2005/03/07 23:26:09 itojun Exp $ */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/netinet/sctputil.c 164181 2006-11-11 15:59:01Z rrs $");
34__FBSDID("$FreeBSD: head/sys/netinet/sctputil.c 164205 2006-11-11 22:44:12Z rrs $");
35
36
37#include "opt_ipsec.h"
38#include "opt_compat.h"
39#include "opt_inet6.h"
40#include "opt_inet.h"
41#include "opt_sctp.h"
42

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

3237 notification, notification);
3238 }
3239#endif /* SCTP_DEBUG */
3240 break;
3241 } /* end switch */
3242}
3243
3244void
35
36
37#include "opt_ipsec.h"
38#include "opt_compat.h"
39#include "opt_inet6.h"
40#include "opt_inet.h"
41#include "opt_sctp.h"
42

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

3237 notification, notification);
3238 }
3239#endif /* SCTP_DEBUG */
3240 break;
3241 } /* end switch */
3242}
3243
3244void
3245sctp_report_all_outbound(struct sctp_tcb *stcb)
3245sctp_report_all_outbound(struct sctp_tcb *stcb, int holds_lock)
3246{
3247 struct sctp_association *asoc;
3248 struct sctp_stream_out *outs;
3249 struct sctp_tmit_chunk *chk;
3250 struct sctp_stream_queue_pending *sp;
3246{
3247 struct sctp_association *asoc;
3248 struct sctp_stream_out *outs;
3249 struct sctp_tmit_chunk *chk;
3250 struct sctp_stream_queue_pending *sp;
3251 int i;
3251
3252 asoc = &stcb->asoc;
3253
3254 if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) ||
3255 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) ||
3256 (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET)) {
3257 return;
3258 }
3259 /* now through all the gunk freeing chunks */
3252
3253 asoc = &stcb->asoc;
3254
3255 if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) ||
3256 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) ||
3257 (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET)) {
3258 return;
3259 }
3260 /* now through all the gunk freeing chunks */
3260
3261 TAILQ_FOREACH(outs, &asoc->out_wheel, next_spoke) {
3262 /* now clean up any chunks here */
3261 if (holds_lock == 0)
3262 SCTP_TCB_SEND_LOCK(stcb);
3263 for (i = 0; i < stcb->asoc.streamoutcnt; i++) {
3264 /* For each stream */
3265 outs = &stcb->asoc.strmout[i];
3266 /* clean up any sends there */
3263 stcb->asoc.locked_on_sending = NULL;
3264 sp = TAILQ_FIRST(&outs->outqueue);
3265 while (sp) {
3266 stcb->asoc.stream_queue_cnt--;
3267 TAILQ_REMOVE(&outs->outqueue, sp, next);
3268 sctp_free_spbufspace(stcb, asoc, sp);
3269 sctp_ulp_notify(SCTP_NOTIFY_SPECIAL_SP_FAIL, stcb,
3270 SCTP_NOTIFY_DATAGRAM_UNSENT, (void *)sp);

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

3333 }
3334 if (chk->whoTo)
3335 sctp_free_remote_addr(chk->whoTo);
3336 chk->whoTo = NULL;
3337 sctp_free_a_chunk(stcb, chk);
3338 chk = TAILQ_FIRST(&asoc->sent_queue);
3339 }
3340 }
3267 stcb->asoc.locked_on_sending = NULL;
3268 sp = TAILQ_FIRST(&outs->outqueue);
3269 while (sp) {
3270 stcb->asoc.stream_queue_cnt--;
3271 TAILQ_REMOVE(&outs->outqueue, sp, next);
3272 sctp_free_spbufspace(stcb, asoc, sp);
3273 sctp_ulp_notify(SCTP_NOTIFY_SPECIAL_SP_FAIL, stcb,
3274 SCTP_NOTIFY_DATAGRAM_UNSENT, (void *)sp);

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

3337 }
3338 if (chk->whoTo)
3339 sctp_free_remote_addr(chk->whoTo);
3340 chk->whoTo = NULL;
3341 sctp_free_a_chunk(stcb, chk);
3342 chk = TAILQ_FIRST(&asoc->sent_queue);
3343 }
3344 }
3345 if (holds_lock == 0)
3346 SCTP_TCB_SEND_UNLOCK(stcb);
3341}
3342
3343void
3344sctp_abort_notification(struct sctp_tcb *stcb, int error)
3345{
3346
3347 if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) ||
3348 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) ||
3349 (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET)) {
3350 return;
3351 }
3352 /* Tell them we lost the asoc */
3347}
3348
3349void
3350sctp_abort_notification(struct sctp_tcb *stcb, int error)
3351{
3352
3353 if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) ||
3354 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) ||
3355 (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET)) {
3356 return;
3357 }
3358 /* Tell them we lost the asoc */
3353 sctp_report_all_outbound(stcb);
3359 sctp_report_all_outbound(stcb, 1);
3354 if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3355 ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) &&
3356 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_CONNECTED))) {
3357 stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_WAS_ABORTED;
3358 }
3359 sctp_ulp_notify(SCTP_NOTIFY_ASSOC_ABORTED, stcb, error, NULL);
3360}
3361

--- 2002 unchanged lines hidden ---
3360 if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3361 ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) &&
3362 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_CONNECTED))) {
3363 stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_WAS_ABORTED;
3364 }
3365 sctp_ulp_notify(SCTP_NOTIFY_ASSOC_ABORTED, stcb, error, NULL);
3366}
3367

--- 2002 unchanged lines hidden ---