Make struct sctp_paddrthlds compliant to RFC 7829.

This commit is contained in:
Michael Tuexen 2016-05-26 11:38:26 +00:00
parent 1447d404e0
commit 4f3b84b524
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=300733
2 changed files with 9 additions and 0 deletions

View File

@ -590,6 +590,7 @@ struct sctp_paddrthlds {
sctp_assoc_t spt_assoc_id;
uint16_t spt_pathmaxrxt;
uint16_t spt_pathpfthld;
uint16_t spt_pathcpthld;
};
struct sctp_paddrinfo {

View File

@ -3304,9 +3304,11 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
if (net != NULL) {
thlds->spt_pathmaxrxt = net->failure_threshold;
thlds->spt_pathpfthld = net->pf_threshold;
thlds->spt_pathcpthld = 0xffff;
} else {
thlds->spt_pathmaxrxt = stcb->asoc.def_net_failure;
thlds->spt_pathpfthld = stcb->asoc.def_net_pf_threshold;
thlds->spt_pathcpthld = 0xffff;
}
thlds->spt_assoc_id = sctp_get_associd(stcb);
SCTP_TCB_UNLOCK(stcb);
@ -3318,6 +3320,7 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
SCTP_INP_RLOCK(inp);
thlds->spt_pathmaxrxt = inp->sctp_ep.def_net_failure;
thlds->spt_pathpfthld = inp->sctp_ep.def_net_pf_threshold;
thlds->spt_pathcpthld = 0xffff;
SCTP_INP_RUNLOCK(inp);
} else {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
@ -6345,6 +6348,11 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
break;
}
}
if (thlds->spt_pathcpthld != 0xffff) {
error = EINVAL;
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
break;
}
if (stcb != NULL) {
if (net != NULL) {
net->failure_threshold = thlds->spt_pathmaxrxt;