summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authortuexen <tuexen@FreeBSD.org>2015-06-22 05:34:13 +0000
committertuexen <tuexen@FreeBSD.org>2015-06-22 05:34:13 +0000
commitb52cec9e004cf987627b2d6d72032b0461a8f963 (patch)
treebe60ead62ede1d3ade287a075f3b2142b35fb86c /sys/netinet
parenta42ec2035f7e41a01b3cc0f6bf45c57fb6c9cd39 (diff)
downloadFreeBSD-src-b52cec9e004cf987627b2d6d72032b0461a8f963.zip
FreeBSD-src-b52cec9e004cf987627b2d6d72032b0461a8f963.tar.gz
MFC r284596:
When setting the primary address, return an error whenever it fails.
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/sctp_usrreq.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c
index 78bfe5e..907412c 100644
--- a/sys/netinet/sctp_usrreq.c
+++ b/sys/netinet/sctp_usrreq.c
@@ -5678,16 +5678,23 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
}
if ((stcb != NULL) && (net != NULL)) {
- if ((net != stcb->asoc.primary_destination) &&
- (!(net->dest_state & SCTP_ADDR_UNCONFIRMED))) {
- /* Ok we need to set it */
- if (sctp_set_primary_addr(stcb, (struct sockaddr *)NULL, net) == 0) {
- if ((stcb->asoc.alternate) &&
- (!(net->dest_state & SCTP_ADDR_PF)) &&
- (net->dest_state & SCTP_ADDR_REACHABLE)) {
- sctp_free_remote_addr(stcb->asoc.alternate);
- stcb->asoc.alternate = NULL;
+ if (net != stcb->asoc.primary_destination) {
+ if (!(net->dest_state & SCTP_ADDR_UNCONFIRMED)) {
+ /* Ok we need to set it */
+ if (sctp_set_primary_addr(stcb, (struct sockaddr *)NULL, net) == 0) {
+ if ((stcb->asoc.alternate) &&
+ (!(net->dest_state & SCTP_ADDR_PF)) &&
+ (net->dest_state & SCTP_ADDR_REACHABLE)) {
+ sctp_free_remote_addr(stcb->asoc.alternate);
+ stcb->asoc.alternate = NULL;
+ }
+ } else {
+ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
+ error = EINVAL;
}
+ } else {
+ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
+ error = EINVAL;
}
}
} else {
OpenPOWER on IntegriCloud