From 4f3b84b524cd67a7412c073c9091b9e619937114 Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Thu, 26 May 2016 11:38:26 +0000 Subject: [PATCH] Make struct sctp_paddrthlds compliant to RFC 7829. --- sys/netinet/sctp_uio.h | 1 + sys/netinet/sctp_usrreq.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/sys/netinet/sctp_uio.h b/sys/netinet/sctp_uio.h index 248a25e31642..c7e441dad06e 100644 --- a/sys/netinet/sctp_uio.h +++ b/sys/netinet/sctp_uio.h @@ -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 { diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 49d3e42fe486..7b65d5337e4e 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -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;