From 507c72969d0e965b1e4566192ce3686e83529ebe Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Wed, 26 Jan 2011 19:55:54 +0000 Subject: [PATCH] Make SCTP_MAX_BURST compliant with the latest version of the socket API ID. This is not compatible with the API in stable/8. --- sys/netinet/sctp_usrreq.c | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 9db33fb9895b..6abeb38581cc 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -1967,18 +1967,21 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize, break; case SCTP_MAX_BURST: { - uint8_t *value; + struct sctp_assoc_value *av; - SCTP_CHECK_AND_CAST(value, optval, uint8_t, *optsize); + SCTP_CHECK_AND_CAST(av, optval, struct sctp_assoc_value, *optsize); + SCTP_FIND_STCB(inp, stcb, av->assoc_id); - SCTP_INP_RLOCK(inp); - if (inp->sctp_ep.max_burst < 256) { - *value = inp->sctp_ep.max_burst; + if (stcb) { + av->assoc_value = stcb->asoc.max_burst; + SCTP_TCB_UNLOCK(stcb); } else { - *value = 255; + SCTP_INP_RLOCK(inp); + av->assoc_value = inp->sctp_ep.max_burst; + SCTP_INP_RUNLOCK(inp); } - SCTP_INP_RUNLOCK(inp); - *optsize = sizeof(uint8_t); + *optsize = sizeof(struct sctp_assoc_value); + } break; case SCTP_MAXSEG: @@ -3590,13 +3593,19 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, break; case SCTP_MAX_BURST: { - uint8_t *burst; + struct sctp_assoc_value *av; - SCTP_CHECK_AND_CAST(burst, optval, uint8_t, optsize); + SCTP_CHECK_AND_CAST(av, optval, struct sctp_assoc_value, optsize); + SCTP_FIND_STCB(inp, stcb, av->assoc_id); - SCTP_INP_WLOCK(inp); - inp->sctp_ep.max_burst = *burst; - SCTP_INP_WUNLOCK(inp); + if (stcb) { + stcb->asoc.max_burst = av->assoc_value; + SCTP_TCB_UNLOCK(stcb); + } else { + SCTP_INP_WLOCK(inp); + inp->sctp_ep.max_burst = av->assoc_value; + SCTP_INP_WUNLOCK(inp); + } } break; case SCTP_MAXSEG: