Deleted Added
full compact
sctp_usrreq.c (235403) sctp_usrreq.c (235414)
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 235403 2012-05-13 16:56:16Z tuexen $");
36__FBSDID("$FreeBSD: head/sys/netinet/sctp_usrreq.c 235414 2012-05-13 17:36:04Z 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>

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

265 * NO protocol at the other end named SCTP. well we consider
266 * it a OOTB abort.
267 */
268 if (net->dest_state & SCTP_ADDR_REACHABLE) {
269 /* Ok that destination is NOT reachable */
270 net->dest_state &= ~SCTP_ADDR_REACHABLE;
271 net->dest_state &= ~SCTP_ADDR_PF;
272 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN,
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>

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

265 * NO protocol at the other end named SCTP. well we consider
266 * it a OOTB abort.
267 */
268 if (net->dest_state & SCTP_ADDR_REACHABLE) {
269 /* Ok that destination is NOT reachable */
270 net->dest_state &= ~SCTP_ADDR_REACHABLE;
271 net->dest_state &= ~SCTP_ADDR_PF;
272 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN,
273 stcb, SCTP_FAILED_THRESHOLD,
273 stcb, 0,
274 (void *)net, SCTP_SO_NOT_LOCKED);
275 }
276 SCTP_TCB_UNLOCK(stcb);
277 } else if ((icmph->icmp_code == ICMP_UNREACH_PROTOCOL) ||
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

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

4821 sctp_send_hb(stcb, net, SCTP_SO_LOCKED);
4822 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_TIMER + SCTP_LOC_3);
4823 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net);
4824 }
4825 }
4826 if (net->dest_state & SCTP_ADDR_REACHABLE) {
4827 if (net->error_count > paddrp->spp_pathmaxrxt) {
4828 net->dest_state &= ~SCTP_ADDR_REACHABLE;
274 (void *)net, SCTP_SO_NOT_LOCKED);
275 }
276 SCTP_TCB_UNLOCK(stcb);
277 } else if ((icmph->icmp_code == ICMP_UNREACH_PROTOCOL) ||
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

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

4821 sctp_send_hb(stcb, net, SCTP_SO_LOCKED);
4822 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_TIMER + SCTP_LOC_3);
4823 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net);
4824 }
4825 }
4826 if (net->dest_state & SCTP_ADDR_REACHABLE) {
4827 if (net->error_count > paddrp->spp_pathmaxrxt) {
4828 net->dest_state &= ~SCTP_ADDR_REACHABLE;
4829 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, SCTP_RESPONSE_TO_USER_REQ, net, SCTP_SO_LOCKED);
4829 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, 0, net, SCTP_SO_LOCKED);
4830 }
4831 } else {
4832 if (net->error_count <= paddrp->spp_pathmaxrxt) {
4833 net->dest_state |= SCTP_ADDR_REACHABLE;
4830 }
4831 } else {
4832 if (net->error_count <= paddrp->spp_pathmaxrxt) {
4833 net->dest_state |= SCTP_ADDR_REACHABLE;
4834 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, SCTP_RESPONSE_TO_USER_REQ, net, SCTP_SO_LOCKED);
4834 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, 0, net, SCTP_SO_LOCKED);
4835 }
4836 }
4837 net->failure_threshold = paddrp->spp_pathmaxrxt;
4838 }
4839 if (paddrp->spp_flags & SPP_DSCP) {
4840 net->dscp = paddrp->spp_dscp & 0xfc;
4841 net->dscp |= 0x01;
4842 }

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

4864 sctp_send_hb(stcb, net, SCTP_SO_LOCKED);
4865 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_TIMER + SCTP_LOC_3);
4866 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net);
4867 }
4868 }
4869 if (net->dest_state & SCTP_ADDR_REACHABLE) {
4870 if (net->error_count > paddrp->spp_pathmaxrxt) {
4871 net->dest_state &= ~SCTP_ADDR_REACHABLE;
4835 }
4836 }
4837 net->failure_threshold = paddrp->spp_pathmaxrxt;
4838 }
4839 if (paddrp->spp_flags & SPP_DSCP) {
4840 net->dscp = paddrp->spp_dscp & 0xfc;
4841 net->dscp |= 0x01;
4842 }

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

4864 sctp_send_hb(stcb, net, SCTP_SO_LOCKED);
4865 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_TIMER + SCTP_LOC_3);
4866 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net);
4867 }
4868 }
4869 if (net->dest_state & SCTP_ADDR_REACHABLE) {
4870 if (net->error_count > paddrp->spp_pathmaxrxt) {
4871 net->dest_state &= ~SCTP_ADDR_REACHABLE;
4872 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, SCTP_RESPONSE_TO_USER_REQ, net, SCTP_SO_LOCKED);
4872 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, 0, net, SCTP_SO_LOCKED);
4873 }
4874 } else {
4875 if (net->error_count <= paddrp->spp_pathmaxrxt) {
4876 net->dest_state |= SCTP_ADDR_REACHABLE;
4873 }
4874 } else {
4875 if (net->error_count <= paddrp->spp_pathmaxrxt) {
4876 net->dest_state |= SCTP_ADDR_REACHABLE;
4877 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, SCTP_RESPONSE_TO_USER_REQ, net, SCTP_SO_LOCKED);
4877 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, 0, net, SCTP_SO_LOCKED);
4878 }
4879 }
4880 net->failure_threshold = paddrp->spp_pathmaxrxt;
4881 }
4882 }
4883 if (paddrp->spp_flags & SPP_HB_ENABLE) {
4884 if (paddrp->spp_hbinterval) {
4885 stcb->asoc.heart_beat_delay = paddrp->spp_hbinterval;

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

5675 sctp_send_hb(stcb, net, SCTP_SO_LOCKED);
5676 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_TIMER + SCTP_LOC_3);
5677 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net);
5678 }
5679 }
5680 if (net->dest_state & SCTP_ADDR_REACHABLE) {
5681 if (net->failure_threshold > thlds->spt_pathmaxrxt) {
5682 net->dest_state &= ~SCTP_ADDR_REACHABLE;
4878 }
4879 }
4880 net->failure_threshold = paddrp->spp_pathmaxrxt;
4881 }
4882 }
4883 if (paddrp->spp_flags & SPP_HB_ENABLE) {
4884 if (paddrp->spp_hbinterval) {
4885 stcb->asoc.heart_beat_delay = paddrp->spp_hbinterval;

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

5675 sctp_send_hb(stcb, net, SCTP_SO_LOCKED);
5676 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_TIMER + SCTP_LOC_3);
5677 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net);
5678 }
5679 }
5680 if (net->dest_state & SCTP_ADDR_REACHABLE) {
5681 if (net->failure_threshold > thlds->spt_pathmaxrxt) {
5682 net->dest_state &= ~SCTP_ADDR_REACHABLE;
5683 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, SCTP_RESPONSE_TO_USER_REQ, net, SCTP_SO_LOCKED);
5683 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, 0, net, SCTP_SO_LOCKED);
5684 }
5685 } else {
5686 if (net->failure_threshold <= thlds->spt_pathmaxrxt) {
5687 net->dest_state |= SCTP_ADDR_REACHABLE;
5684 }
5685 } else {
5686 if (net->failure_threshold <= thlds->spt_pathmaxrxt) {
5687 net->dest_state |= SCTP_ADDR_REACHABLE;
5688 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, SCTP_RESPONSE_TO_USER_REQ, net, SCTP_SO_LOCKED);
5688 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, 0, net, SCTP_SO_LOCKED);
5689 }
5690 }
5691 net->failure_threshold = thlds->spt_pathmaxrxt;
5692 net->pf_threshold = thlds->spt_pathpfthld;
5693 } else {
5694 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5695 if (net->dest_state & SCTP_ADDR_PF) {
5696 if ((net->failure_threshold > thlds->spt_pathmaxrxt) ||

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

5704 sctp_send_hb(stcb, net, SCTP_SO_LOCKED);
5705 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_TIMER + SCTP_LOC_3);
5706 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net);
5707 }
5708 }
5709 if (net->dest_state & SCTP_ADDR_REACHABLE) {
5710 if (net->failure_threshold > thlds->spt_pathmaxrxt) {
5711 net->dest_state &= ~SCTP_ADDR_REACHABLE;
5689 }
5690 }
5691 net->failure_threshold = thlds->spt_pathmaxrxt;
5692 net->pf_threshold = thlds->spt_pathpfthld;
5693 } else {
5694 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5695 if (net->dest_state & SCTP_ADDR_PF) {
5696 if ((net->failure_threshold > thlds->spt_pathmaxrxt) ||

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

5704 sctp_send_hb(stcb, net, SCTP_SO_LOCKED);
5705 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_TIMER + SCTP_LOC_3);
5706 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net);
5707 }
5708 }
5709 if (net->dest_state & SCTP_ADDR_REACHABLE) {
5710 if (net->failure_threshold > thlds->spt_pathmaxrxt) {
5711 net->dest_state &= ~SCTP_ADDR_REACHABLE;
5712 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, SCTP_RESPONSE_TO_USER_REQ, net, SCTP_SO_LOCKED);
5712 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, 0, net, SCTP_SO_LOCKED);
5713 }
5714 } else {
5715 if (net->failure_threshold <= thlds->spt_pathmaxrxt) {
5716 net->dest_state |= SCTP_ADDR_REACHABLE;
5713 }
5714 } else {
5715 if (net->failure_threshold <= thlds->spt_pathmaxrxt) {
5716 net->dest_state |= SCTP_ADDR_REACHABLE;
5717 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, SCTP_RESPONSE_TO_USER_REQ, net, SCTP_SO_LOCKED);
5717 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, 0, net, SCTP_SO_LOCKED);
5718 }
5719 }
5720 net->failure_threshold = thlds->spt_pathmaxrxt;
5721 net->pf_threshold = thlds->spt_pathpfthld;
5722 }
5723 stcb->asoc.def_net_failure = thlds->spt_pathmaxrxt;
5724 stcb->asoc.def_net_pf_threshold = thlds->spt_pathpfthld;
5725 }

--- 778 unchanged lines hidden ---
5718 }
5719 }
5720 net->failure_threshold = thlds->spt_pathmaxrxt;
5721 net->pf_threshold = thlds->spt_pathpfthld;
5722 }
5723 stcb->asoc.def_net_failure = thlds->spt_pathmaxrxt;
5724 stcb->asoc.def_net_pf_threshold = thlds->spt_pathpfthld;
5725 }

--- 778 unchanged lines hidden ---