sctp_usrreq.c (244730) | sctp_usrreq.c (246588) |
---|---|
1/*- 2 * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. 3 * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. 4 * Copyright (c) 2008-2012, 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 * --- 17 unchanged lines hidden (view full) --- 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 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#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. 3 * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. 4 * Copyright (c) 2008-2012, 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 * --- 17 unchanged lines hidden (view full) --- 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 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#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/netinet/sctp_usrreq.c 244730 2012-12-27 08:10:58Z tuexen $"); | 34__FBSDID("$FreeBSD: head/sys/netinet/sctp_usrreq.c 246588 2013-02-09 08:27:08Z tuexen $"); |
35 36#include <netinet/sctp_os.h> 37#include <sys/proc.h> 38#include <netinet/sctp_pcb.h> 39#include <netinet/sctp_header.h> 40#include <netinet/sctp_var.h> 41#ifdef INET6 42#endif --- 746 unchanged lines hidden (view full) --- 789 if (asoc->locked_on_sending) { 790 goto abort_anyway; 791 } 792 if ((SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_SENT) && 793 (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_ACK_SENT)) { 794 /* only send SHUTDOWN 1st time thru */ 795 struct sctp_nets *netp; 796 | 35 36#include <netinet/sctp_os.h> 37#include <sys/proc.h> 38#include <netinet/sctp_pcb.h> 39#include <netinet/sctp_header.h> 40#include <netinet/sctp_var.h> 41#ifdef INET6 42#endif --- 746 unchanged lines hidden (view full) --- 789 if (asoc->locked_on_sending) { 790 goto abort_anyway; 791 } 792 if ((SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_SENT) && 793 (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_ACK_SENT)) { 794 /* only send SHUTDOWN 1st time thru */ 795 struct sctp_nets *netp; 796 |
797 if (stcb->asoc.alternate) { 798 netp = stcb->asoc.alternate; 799 } else { 800 netp = stcb->asoc.primary_destination; 801 } 802 sctp_stop_timers_for_shutdown(stcb); 803 sctp_send_shutdown(stcb, netp); 804 sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_T3, SCTP_SO_LOCKED); | |
805 if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) || 806 (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { 807 SCTP_STAT_DECR_GAUGE32(sctps_currestab); 808 } 809 SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT); 810 SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); | 797 if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) || 798 (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { 799 SCTP_STAT_DECR_GAUGE32(sctps_currestab); 800 } 801 SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT); 802 SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); |
803 sctp_stop_timers_for_shutdown(stcb); 804 if (stcb->asoc.alternate) { 805 netp = stcb->asoc.alternate; 806 } else { 807 netp = stcb->asoc.primary_destination; 808 } 809 sctp_send_shutdown(stcb, netp); |
|
811 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, 812 stcb->sctp_ep, stcb, netp); 813 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, 814 stcb->sctp_ep, stcb, netp); | 810 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, 811 stcb->sctp_ep, stcb, netp); 812 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, 813 stcb->sctp_ep, stcb, netp); |
815 | 814 sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_T3, SCTP_SO_LOCKED); |
816 } 817 } else { 818 /* 819 * we still got (or just got) data to send, 820 * so set SHUTDOWN_PENDING 821 */ 822 /* 823 * XXX sockets draft says that SCTP_EOF --- 185 unchanged lines hidden (view full) --- 1009 if (asoc->locked_on_sending) { 1010 goto abort_anyway; 1011 } 1012 /* there is nothing queued to send, so I'm done... */ 1013 if (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_SENT) { 1014 /* only send SHUTDOWN the first time through */ 1015 struct sctp_nets *netp; 1016 | 815 } 816 } else { 817 /* 818 * we still got (or just got) data to send, 819 * so set SHUTDOWN_PENDING 820 */ 821 /* 822 * XXX sockets draft says that SCTP_EOF --- 185 unchanged lines hidden (view full) --- 1008 if (asoc->locked_on_sending) { 1009 goto abort_anyway; 1010 } 1011 /* there is nothing queued to send, so I'm done... */ 1012 if (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_SENT) { 1013 /* only send SHUTDOWN the first time through */ 1014 struct sctp_nets *netp; 1015 |
1017 if (stcb->asoc.alternate) { 1018 netp = stcb->asoc.alternate; 1019 } else { 1020 netp = stcb->asoc.primary_destination; 1021 } 1022 sctp_stop_timers_for_shutdown(stcb); 1023 sctp_send_shutdown(stcb, netp); 1024 sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_T3, SCTP_SO_LOCKED); | |
1025 if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) || 1026 (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { 1027 SCTP_STAT_DECR_GAUGE32(sctps_currestab); 1028 } 1029 SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT); 1030 SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); | 1016 if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) || 1017 (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { 1018 SCTP_STAT_DECR_GAUGE32(sctps_currestab); 1019 } 1020 SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT); 1021 SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); |
1022 sctp_stop_timers_for_shutdown(stcb); 1023 if (stcb->asoc.alternate) { 1024 netp = stcb->asoc.alternate; 1025 } else { 1026 netp = stcb->asoc.primary_destination; 1027 } 1028 sctp_send_shutdown(stcb, netp); |
|
1031 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, 1032 stcb->sctp_ep, stcb, netp); 1033 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, 1034 stcb->sctp_ep, stcb, netp); | 1029 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, 1030 stcb->sctp_ep, stcb, netp); 1031 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, 1032 stcb->sctp_ep, stcb, netp); |
1033 sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_T3, SCTP_SO_LOCKED); |
|
1035 } 1036 } else { 1037 /* 1038 * we still got (or just got) data to send, so set 1039 * SHUTDOWN_PENDING 1040 */ 1041 struct sctp_nets *netp; 1042 --- 5447 unchanged lines hidden --- | 1034 } 1035 } else { 1036 /* 1037 * we still got (or just got) data to send, so set 1038 * SHUTDOWN_PENDING 1039 */ 1040 struct sctp_nets *netp; 1041 --- 5447 unchanged lines hidden --- |