MFC r279886:
Fix the adaptation of the path state when thresholds are changed using the SCTP_PEER_ADDR_THLDS socket option.
This commit is contained in:
parent
16fb87c63d
commit
a29e8c28ca
@ -6189,14 +6189,16 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
|
||||
}
|
||||
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 optname, void *optval, size_t optsize,
|
||||
}
|
||||
}
|
||||
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 optname, void *optval, size_t optsize,
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user