Fix the adaptation of the path state when thresholds are changed

using the SCTP_PEER_ADDR_THLDS socket option.

MFC after: 3 days
This commit is contained in:
Michael Tuexen 2015-03-11 14:25:23 +00:00
parent 553f54b8c5
commit b3bf169ac7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=279886

View File

@ -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;