Author: tuexen
Date: Fri May 29 13:02:00 2015
New Revision: 283727
URL: https://svnweb.freebsd.org/changeset/base/283727

Log:
  MFC r279886:
  
  Fix the adaptation of the path state when thresholds are changed
  using the SCTP_PEER_ADDR_THLDS socket option.

Modified:
  stable/10/sys/netinet/sctp_usrreq.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet/sctp_usrreq.c
==============================================================================
--- stable/10/sys/netinet/sctp_usrreq.c Fri May 29 12:59:18 2015        
(r283726)
+++ stable/10/sys/netinet/sctp_usrreq.c Fri May 29 13:02:00 2015        
(r283727)
@@ -6189,14 +6189,16 @@ sctp_setopt(struct socket *so, int optna
                        }
                        if (stcb != NULL) {
                                if (net != NULL) {
+                                       net->failure_threshold = 
thlds->spt_pathmaxrxt;
+                                       net->pf_threshold = 
thlds->spt_pathpfthld;
                                        if (net->dest_state & SCTP_ADDR_PF) {
-                                               if ((net->failure_threshold > 
thlds->spt_pathmaxrxt) ||
-                                                   (net->failure_threshold <= 
thlds->spt_pathpfthld)) {
+                                               if ((net->error_count > 
net->failure_threshold) ||
+                                                   (net->error_count <= 
net->pf_threshold)) {
                                                        net->dest_state &= 
~SCTP_ADDR_PF;
                                                }
                                        } else {
-                                               if ((net->failure_threshold > 
thlds->spt_pathpfthld) &&
-                                                   (net->failure_threshold <= 
thlds->spt_pathmaxrxt)) {
+                                               if ((net->error_count > 
net->pf_threshold) &&
+                                                   (net->error_count <= 
net->failure_threshold)) {
                                                        net->dest_state |= 
SCTP_ADDR_PF;
                                                        sctp_send_hb(stcb, net, 
SCTP_SO_LOCKED);
                                                        
sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net, 
SCTP_FROM_SCTP_TIMER + SCTP_LOC_3);
@@ -6204,28 +6206,28 @@ sctp_setopt(struct socket *so, int optna
                                                }
                                        }
                                        if (net->dest_state & 
SCTP_ADDR_REACHABLE) {
-                                               if (net->failure_threshold > 
thlds->spt_pathmaxrxt) {
+                                               if (net->error_count > 
net->failure_threshold) {
                                                        net->dest_state &= 
~SCTP_ADDR_REACHABLE;
                                                        
sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, 0, net, SCTP_SO_LOCKED);
                                                }
                                        } else {
-                                               if (net->failure_threshold <= 
thlds->spt_pathmaxrxt) {
+                                               if (net->error_count <= 
net->failure_threshold) {
                                                        net->dest_state |= 
SCTP_ADDR_REACHABLE;
                                                        
sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, 0, net, SCTP_SO_LOCKED);
                                                }
                                        }
-                                       net->failure_threshold = 
thlds->spt_pathmaxrxt;
-                                       net->pf_threshold = 
thlds->spt_pathpfthld;
                                } else {
                                        TAILQ_FOREACH(net, &stcb->asoc.nets, 
sctp_next) {
+                                               net->failure_threshold = 
thlds->spt_pathmaxrxt;
+                                               net->pf_threshold = 
thlds->spt_pathpfthld;
                                                if (net->dest_state & 
SCTP_ADDR_PF) {
-                                                       if 
((net->failure_threshold > thlds->spt_pathmaxrxt) ||
-                                                           
(net->failure_threshold <= thlds->spt_pathpfthld)) {
+                                                       if ((net->error_count > 
net->failure_threshold) ||
+                                                           (net->error_count 
<= net->pf_threshold)) {
                                                                net->dest_state 
&= ~SCTP_ADDR_PF;
                                                        }
                                                } else {
-                                                       if 
((net->failure_threshold > thlds->spt_pathpfthld) &&
-                                                           
(net->failure_threshold <= thlds->spt_pathmaxrxt)) {
+                                                       if ((net->error_count > 
net->pf_threshold) &&
+                                                           (net->error_count 
<= net->failure_threshold)) {
                                                                net->dest_state 
|= SCTP_ADDR_PF;
                                                                
sctp_send_hb(stcb, net, SCTP_SO_LOCKED);
                                                                
sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net, 
SCTP_FROM_SCTP_TIMER + SCTP_LOC_3);
@@ -6233,18 +6235,16 @@ sctp_setopt(struct socket *so, int optna
                                                        }
                                                }
                                                if (net->dest_state & 
SCTP_ADDR_REACHABLE) {
-                                                       if 
(net->failure_threshold > thlds->spt_pathmaxrxt) {
+                                                       if (net->error_count > 
net->failure_threshold) {
                                                                net->dest_state 
&= ~SCTP_ADDR_REACHABLE;
                                                                
sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, 0, net, SCTP_SO_LOCKED);
                                                        }
                                                } else {
-                                                       if 
(net->failure_threshold <= thlds->spt_pathmaxrxt) {
+                                                       if (net->error_count <= 
net->failure_threshold) {
                                                                net->dest_state 
|= SCTP_ADDR_REACHABLE;
                                                                
sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, 0, net, SCTP_SO_LOCKED);
                                                        }
                                                }
-                                               net->failure_threshold = 
thlds->spt_pathmaxrxt;
-                                               net->pf_threshold = 
thlds->spt_pathpfthld;
                                        }
                                        stcb->asoc.def_net_failure = 
thlds->spt_pathmaxrxt;
                                        stcb->asoc.def_net_pf_threshold = 
thlds->spt_pathpfthld;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to