提交 b96144da authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo
上级 73a7eabf
......@@ -34,7 +34,7 @@
#ifdef __FreeBSD__
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: head/sys/netinet/sctp_input.c 353518 2019-10-14 20:32:11Z tuexen $");
__FBSDID("$FreeBSD: head/sys/netinet/sctp_input.c 355135 2019-11-27 19:32:29Z tuexen $");
#endif
#include <netinet/sctp_os.h>
......@@ -526,6 +526,9 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset,
/* process the peer's parameters in the INIT-ACK */
retval = sctp_process_init((struct sctp_init_chunk *)cp, stcb);
if (retval < 0) {
if (op_err != NULL) {
sctp_m_freem(op_err);
}
return (retval);
}
initack_limit = offset + ntohs(cp->ch.chunk_length);
......@@ -533,6 +536,9 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset,
if ((retval = sctp_load_addresses_from_init(stcb, m,
(offset + sizeof(struct sctp_init_chunk)), initack_limit,
src, dst, NULL, stcb->asoc.port))) {
if (op_err != NULL) {
sctp_m_freem(op_err);
}
op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code),
"Problem with address parameters");
SCTPDBG(SCTP_DEBUG_INPUT1,
......
......@@ -34,7 +34,7 @@
#ifdef __FreeBSD__
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: head/sys/netinet/sctp_usrreq.c 353480 2019-10-13 18:17:08Z tuexen $");
__FBSDID("$FreeBSD: head/sys/netinet/sctp_usrreq.c 355172 2019-11-28 12:50:25Z tuexen $");
#endif
#include <netinet/sctp_os.h>
......@@ -180,8 +180,8 @@ sctp_init(void)
timeout(sctp_delayed_startup, NULL, 1);
#endif
#if defined(__FreeBSD__)
EVENTHANDLER_REGISTER(rt_addrmsg, sctp_addr_change_event_handler,
NULL, EVENTHANDLER_PRI_FIRST);
SCTP_BASE_VAR(eh_tag) = EVENTHANDLER_REGISTER(rt_addrmsg,
sctp_addr_change_event_handler, NULL, EVENTHANDLER_PRI_FIRST);
#endif
}
......@@ -2299,7 +2299,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
if (inp->idata_supported) {
av->assoc_value = 1;
......@@ -2329,7 +2330,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
av->assoc_value = inp->sctp_cmt_on_off;
SCTP_INP_RUNLOCK(inp);
......@@ -2355,7 +2357,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
av->assoc_value = inp->sctp_ep.sctp_default_cc_module;
SCTP_INP_RUNLOCK(inp);
......@@ -2400,7 +2403,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
av->assoc_value = inp->sctp_ep.sctp_default_ss_module;
SCTP_INP_RUNLOCK(inp);
......@@ -2541,7 +2545,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
av->assoc_value = inp->sctp_context;
SCTP_INP_RUNLOCK(inp);
......@@ -2632,7 +2637,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(sack->sack_assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(sack->sack_assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
sack->sack_delay = TICKS_TO_MSEC(inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_RECV]);
sack->sack_freq = inp->sctp_ep.sctp_sack_freq;
......@@ -2693,7 +2699,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
av->assoc_value = inp->sctp_ep.max_burst;
SCTP_INP_RUNLOCK(inp);
......@@ -2722,7 +2729,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
ovh = SCTP_MED_OVERHEAD;
......@@ -3148,7 +3156,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(paddrp->spp_assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(paddrp->spp_assoc_id == SCTP_FUTURE_ASSOC))) {
/* Use endpoint defaults */
SCTP_INP_RLOCK(inp);
paddrp->spp_pathmaxrxt = inp->sctp_ep.def_net_failure;
......@@ -3394,7 +3403,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(srto->srto_assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(srto->srto_assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
srto->srto_initial = inp->sctp_ep.initial_rto;
srto->srto_max = inp->sctp_ep.sctp_maxrto;
......@@ -3450,7 +3460,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(sasoc->sasoc_assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(sasoc->sasoc_assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
sasoc->sasoc_cookie_life = TICKS_TO_MSEC(inp->sctp_ep.def_cookie_life);
sasoc->sasoc_asocmaxrxt = inp->sctp_ep.max_send_times;
......@@ -3481,7 +3492,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(s_info->sinfo_assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(s_info->sinfo_assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
memcpy(s_info, &inp->def_send, sizeof(inp->def_send));
SCTP_INP_RUNLOCK(inp);
......@@ -3606,7 +3618,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(scact->scact_assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(scact->scact_assoc_id == SCTP_FUTURE_ASSOC))) {
/* get the endpoint active key */
SCTP_INP_RLOCK(inp);
scact->scact_keynumber = inp->sctp_ep.default_keyid;
......@@ -3648,7 +3661,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(sac->gauth_assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(sac->gauth_assoc_id == SCTP_FUTURE_ASSOC))) {
/* get off the endpoint */
SCTP_INP_RLOCK(inp);
chklist = inp->sctp_ep.local_auth_chunks;
......@@ -3780,7 +3794,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(event->se_assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(event->se_assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
event->se_on = sctp_is_feature_on(inp, event_type);
SCTP_INP_RUNLOCK(inp);
......@@ -3853,7 +3868,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(info->snd_assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(info->snd_assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
info->snd_sid = inp->def_send.sinfo_stream;
info->snd_flags = inp->def_send.sinfo_flags;
......@@ -3885,7 +3901,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(info->pr_assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(info->pr_assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
info->pr_policy = PR_SCTP_POLICY(inp->def_send.sinfo_flags);
info->pr_value = inp->def_send.sinfo_timetolive;
......@@ -4006,7 +4023,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(thlds->spt_assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(thlds->spt_assoc_id == SCTP_FUTURE_ASSOC))) {
/* Use endpoint defaults */
SCTP_INP_RLOCK(inp);
thlds->spt_pathmaxrxt = inp->sctp_ep.def_net_failure;
......@@ -4124,7 +4142,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(encaps->sue_assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(encaps->sue_assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
encaps->sue_port = inp->sctp_ep.port;
SCTP_INP_RUNLOCK(inp);
......@@ -4151,7 +4170,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
av->assoc_value = inp->ecn_supported;
SCTP_INP_RUNLOCK(inp);
......@@ -4178,7 +4198,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
av->assoc_value = inp->prsctp_supported;
SCTP_INP_RUNLOCK(inp);
......@@ -4205,7 +4226,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
av->assoc_value = inp->auth_supported;
SCTP_INP_RUNLOCK(inp);
......@@ -4232,7 +4254,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
av->assoc_value = inp->asconf_supported;
SCTP_INP_RUNLOCK(inp);
......@@ -4259,7 +4282,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
av->assoc_value = inp->reconfig_supported;
SCTP_INP_RUNLOCK(inp);
......@@ -4286,7 +4310,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
av->assoc_value = inp->nrsack_supported;
SCTP_INP_RUNLOCK(inp);
......@@ -4313,7 +4338,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
av->assoc_value = inp->pktdrop_supported;
SCTP_INP_RUNLOCK(inp);
......@@ -4340,7 +4366,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
av->assoc_value = (uint32_t)inp->local_strreset_support;
SCTP_INP_RUNLOCK(inp);
......@@ -4442,7 +4469,8 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
av->assoc_value = inp->max_cwnd;
SCTP_INP_RUNLOCK(inp);
......@@ -4635,7 +4663,8 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_WLOCK(inp);
if (av->assoc_value == 0) {
inp->idata_supported = 0;
......@@ -4674,14 +4703,16 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC) ||
(av->assoc_id == SCTP_ALL_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((av->assoc_id == SCTP_FUTURE_ASSOC) ||
(av->assoc_id == SCTP_ALL_ASSOC)))) {
SCTP_INP_WLOCK(inp);
inp->sctp_cmt_on_off = av->assoc_value;
SCTP_INP_WUNLOCK(inp);
}
if ((av->assoc_id == SCTP_CURRENT_ASSOC) ||
(av->assoc_id == SCTP_ALL_ASSOC)) {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((av->assoc_id == SCTP_CURRENT_ASSOC) ||
(av->assoc_id == SCTP_ALL_ASSOC))) {
SCTP_INP_RLOCK(inp);
LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
SCTP_TCB_LOCK(stcb);
......@@ -4723,14 +4754,16 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC) ||
(av->assoc_id == SCTP_ALL_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((av->assoc_id == SCTP_FUTURE_ASSOC) ||
(av->assoc_id == SCTP_ALL_ASSOC)))) {
SCTP_INP_WLOCK(inp);
inp->sctp_ep.sctp_default_cc_module = av->assoc_value;
SCTP_INP_WUNLOCK(inp);
}
if ((av->assoc_id == SCTP_CURRENT_ASSOC) ||
(av->assoc_id == SCTP_ALL_ASSOC)) {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((av->assoc_id == SCTP_CURRENT_ASSOC) ||
(av->assoc_id == SCTP_ALL_ASSOC))) {
SCTP_INP_RLOCK(inp);
LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
SCTP_TCB_LOCK(stcb);
......@@ -4755,7 +4788,8 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
SCTP_CHECK_AND_CAST(cc_opt, optval, struct sctp_cc_option, optsize);
SCTP_FIND_STCB(inp, stcb, cc_opt->aid_value.assoc_id);
if (stcb == NULL) {
if (cc_opt->aid_value.assoc_id == SCTP_CURRENT_ASSOC) {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(cc_opt->aid_value.assoc_id == SCTP_CURRENT_ASSOC)) {
SCTP_INP_RLOCK(inp);
LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
SCTP_TCB_LOCK(stcb);
......@@ -4806,14 +4840,16 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC) ||
(av->assoc_id == SCTP_ALL_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((av->assoc_id == SCTP_FUTURE_ASSOC) ||
(av->assoc_id == SCTP_ALL_ASSOC)))) {
SCTP_INP_WLOCK(inp);
inp->sctp_ep.sctp_default_ss_module = av->assoc_value;
SCTP_INP_WUNLOCK(inp);
}
if ((av->assoc_id == SCTP_CURRENT_ASSOC) ||
(av->assoc_id == SCTP_ALL_ASSOC)) {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((av->assoc_id == SCTP_CURRENT_ASSOC) ||
(av->assoc_id == SCTP_ALL_ASSOC))) {
SCTP_INP_RLOCK(inp);
LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
SCTP_TCB_LOCK(stcb);
......@@ -4845,7 +4881,8 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
}
SCTP_TCB_UNLOCK(stcb);
} else {
if (av->assoc_id == SCTP_CURRENT_ASSOC) {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_CURRENT_ASSOC)) {
SCTP_INP_RLOCK(inp);
LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
SCTP_TCB_LOCK(stcb);
......@@ -4883,14 +4920,16 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC) ||
(av->assoc_id == SCTP_ALL_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((av->assoc_id == SCTP_FUTURE_ASSOC) ||
(av->assoc_id == SCTP_ALL_ASSOC)))) {
SCTP_INP_WLOCK(inp);
inp->sctp_context = av->assoc_value;
SCTP_INP_WUNLOCK(inp);
}
if ((av->assoc_id == SCTP_CURRENT_ASSOC) ||
(av->assoc_id == SCTP_ALL_ASSOC)) {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((av->assoc_id == SCTP_CURRENT_ASSOC) ||
(av->assoc_id == SCTP_ALL_ASSOC))) {
SCTP_INP_RLOCK(inp);
LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
SCTP_TCB_LOCK(stcb);
......@@ -5064,8 +5103,9 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(sack->sack_assoc_id == SCTP_FUTURE_ASSOC) ||
(sack->sack_assoc_id == SCTP_ALL_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((sack->sack_assoc_id == SCTP_FUTURE_ASSOC) ||
(sack->sack_assoc_id == SCTP_ALL_ASSOC)))) {
SCTP_INP_WLOCK(inp);
if (sack->sack_delay) {
inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_RECV] = MSEC_TO_TICKS(sack->sack_delay);
......@@ -5075,8 +5115,9 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
}
SCTP_INP_WUNLOCK(inp);
}
if ((sack->sack_assoc_id == SCTP_CURRENT_ASSOC) ||
(sack->sack_assoc_id == SCTP_ALL_ASSOC)) {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((sack->sack_assoc_id == SCTP_CURRENT_ASSOC) ||
(sack->sack_assoc_id == SCTP_ALL_ASSOC))) {
SCTP_INP_RLOCK(inp);
LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
SCTP_TCB_LOCK(stcb);
......@@ -5163,8 +5204,9 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(sca->sca_assoc_id == SCTP_FUTURE_ASSOC) ||
(sca->sca_assoc_id == SCTP_ALL_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((sca->sca_assoc_id == SCTP_FUTURE_ASSOC) ||
(sca->sca_assoc_id == SCTP_ALL_ASSOC)))) {
SCTP_INP_WLOCK(inp);
shared_keys = &inp->sctp_ep.shared_keys;
/*
......@@ -5198,8 +5240,9 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
error = sctp_insert_sharedkey(shared_keys, shared_key);
SCTP_INP_WUNLOCK(inp);
}
if ((sca->sca_assoc_id == SCTP_CURRENT_ASSOC) ||
(sca->sca_assoc_id == SCTP_ALL_ASSOC)) {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((sca->sca_assoc_id == SCTP_CURRENT_ASSOC) ||
(sca->sca_assoc_id == SCTP_ALL_ASSOC))) {
SCTP_INP_RLOCK(inp);
LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
SCTP_TCB_LOCK(stcb);
......@@ -5307,8 +5350,9 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(scact->scact_assoc_id == SCTP_FUTURE_ASSOC) ||
(scact->scact_assoc_id == SCTP_ALL_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((scact->scact_assoc_id == SCTP_FUTURE_ASSOC) ||
(scact->scact_assoc_id == SCTP_ALL_ASSOC)))) {
SCTP_INP_WLOCK(inp);
if (sctp_auth_setactivekey_ep(inp, scact->scact_keynumber)) {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
......@@ -5316,8 +5360,9 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
}
SCTP_INP_WUNLOCK(inp);
}
if ((scact->scact_assoc_id == SCTP_CURRENT_ASSOC) ||
(scact->scact_assoc_id == SCTP_ALL_ASSOC)) {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((scact->scact_assoc_id == SCTP_CURRENT_ASSOC) ||
(scact->scact_assoc_id == SCTP_ALL_ASSOC))) {
SCTP_INP_RLOCK(inp);
LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
SCTP_TCB_LOCK(stcb);
......@@ -5346,8 +5391,9 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(scdel->scact_assoc_id == SCTP_FUTURE_ASSOC) ||
(scdel->scact_assoc_id == SCTP_ALL_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((scdel->scact_assoc_id == SCTP_FUTURE_ASSOC) ||
(scdel->scact_assoc_id == SCTP_ALL_ASSOC)))) {
SCTP_INP_WLOCK(inp);
if (sctp_delete_sharedkey_ep(inp, scdel->scact_keynumber)) {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
......@@ -5355,8 +5401,9 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
}
SCTP_INP_WUNLOCK(inp);
}
if ((scdel->scact_assoc_id == SCTP_CURRENT_ASSOC) ||
(scdel->scact_assoc_id == SCTP_ALL_ASSOC)) {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((scdel->scact_assoc_id == SCTP_CURRENT_ASSOC) ||
(scdel->scact_assoc_id == SCTP_ALL_ASSOC))) {
SCTP_INP_RLOCK(inp);
LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
SCTP_TCB_LOCK(stcb);
......@@ -5385,8 +5432,9 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(keyid->scact_assoc_id == SCTP_FUTURE_ASSOC) ||
(keyid->scact_assoc_id == SCTP_ALL_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((keyid->scact_assoc_id == SCTP_FUTURE_ASSOC) ||
(keyid->scact_assoc_id == SCTP_ALL_ASSOC)))) {
SCTP_INP_WLOCK(inp);
if (sctp_deact_sharedkey_ep(inp, keyid->scact_keynumber)) {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
......@@ -5394,8 +5442,9 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
}
SCTP_INP_WUNLOCK(inp);
}
if ((keyid->scact_assoc_id == SCTP_CURRENT_ASSOC) ||
(keyid->scact_assoc_id == SCTP_ALL_ASSOC)) {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((keyid->scact_assoc_id == SCTP_CURRENT_ASSOC) ||
(keyid->scact_assoc_id == SCTP_ALL_ASSOC))) {
SCTP_INP_RLOCK(inp);
LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
SCTP_TCB_LOCK(stcb);
......@@ -5424,14 +5473,16 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC) ||
(av->assoc_id == SCTP_ALL_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((av->assoc_id == SCTP_FUTURE_ASSOC) ||
(av->assoc_id == SCTP_ALL_ASSOC)))) {
SCTP_INP_WLOCK(inp);
inp->local_strreset_support = (uint8_t)av->assoc_value;
SCTP_INP_WUNLOCK(inp);
}
if ((av->assoc_id == SCTP_CURRENT_ASSOC) ||
(av->assoc_id == SCTP_ALL_ASSOC)) {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((av->assoc_id == SCTP_CURRENT_ASSOC) ||
(av->assoc_id == SCTP_ALL_ASSOC))) {
SCTP_INP_RLOCK(inp);
LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
SCTP_TCB_LOCK(stcb);
......@@ -5777,14 +5828,16 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC) ||
(av->assoc_id == SCTP_ALL_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((av->assoc_id == SCTP_FUTURE_ASSOC) ||
(av->assoc_id == SCTP_ALL_ASSOC)))) {
SCTP_INP_WLOCK(inp);
inp->sctp_ep.max_burst = av->assoc_value;
SCTP_INP_WUNLOCK(inp);
}
if ((av->assoc_id == SCTP_CURRENT_ASSOC) ||
(av->assoc_id == SCTP_ALL_ASSOC)) {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((av->assoc_id == SCTP_CURRENT_ASSOC) ||
(av->assoc_id == SCTP_ALL_ASSOC))) {
SCTP_INP_RLOCK(inp);
LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
SCTP_TCB_LOCK(stcb);
......@@ -5820,7 +5873,8 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_WLOCK(inp);
/* FIXME MT: I think this is not in tune with the API ID */
if (av->assoc_value) {
......@@ -6025,14 +6079,16 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(s_info->sinfo_assoc_id == SCTP_FUTURE_ASSOC) ||
(s_info->sinfo_assoc_id == SCTP_ALL_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((s_info->sinfo_assoc_id == SCTP_FUTURE_ASSOC) ||
(s_info->sinfo_assoc_id == SCTP_ALL_ASSOC)))) {
SCTP_INP_WLOCK(inp);
memcpy(&inp->def_send, s_info, min(optsize, sizeof(inp->def_send)));
SCTP_INP_WUNLOCK(inp);
}
if ((s_info->sinfo_assoc_id == SCTP_CURRENT_ASSOC) ||
(s_info->sinfo_assoc_id == SCTP_ALL_ASSOC)) {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((s_info->sinfo_assoc_id == SCTP_CURRENT_ASSOC) ||
(s_info->sinfo_assoc_id == SCTP_ALL_ASSOC))) {
SCTP_INP_RLOCK(inp);
LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
SCTP_TCB_LOCK(stcb);
......@@ -6399,7 +6455,8 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
/************************NO TCB, SET TO default stuff ******************/
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(paddrp->spp_assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(paddrp->spp_assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_WLOCK(inp);
/*
* For the TOS/FLOWLABEL stuff you set it
......@@ -6489,7 +6546,8 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(srto->srto_assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(srto->srto_assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_WLOCK(inp);
if (srto->srto_initial)
new_init = srto->srto_initial;
......@@ -6543,7 +6601,8 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(sasoc->sasoc_assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(sasoc->sasoc_assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_WLOCK(inp);
if (sasoc->sasoc_asocmaxrxt)
inp->sctp_ep.max_send_times = sasoc->sasoc_asocmaxrxt;
......@@ -7010,8 +7069,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
* so return an error for sender dry events
*/
if ((event_type == SCTP_PCB_FLAGS_DRYEVNT) &&
((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) == 0) &&
((inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) == 0) &&
(inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((event->se_assoc_id == SCTP_ALL_ASSOC) ||
(event->se_assoc_id == SCTP_CURRENT_ASSOC))) {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOTSUP);
......@@ -7020,8 +7078,9 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
}
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(event->se_assoc_id == SCTP_FUTURE_ASSOC) ||
(event->se_assoc_id == SCTP_ALL_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((event->se_assoc_id == SCTP_FUTURE_ASSOC) ||
(event->se_assoc_id == SCTP_ALL_ASSOC)))) {
SCTP_INP_WLOCK(inp);
if (event->se_on) {
sctp_feature_on(inp, event_type);
......@@ -7030,8 +7089,9 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
}
SCTP_INP_WUNLOCK(inp);
}
if ((event->se_assoc_id == SCTP_CURRENT_ASSOC) ||
(event->se_assoc_id == SCTP_ALL_ASSOC)) {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((event->se_assoc_id == SCTP_CURRENT_ASSOC) ||
(event->se_assoc_id == SCTP_ALL_ASSOC))) {
SCTP_INP_RLOCK(inp);
LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
SCTP_TCB_LOCK(stcb);
......@@ -7104,8 +7164,9 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(info->snd_assoc_id == SCTP_FUTURE_ASSOC) ||
(info->snd_assoc_id == SCTP_ALL_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((info->snd_assoc_id == SCTP_FUTURE_ASSOC) ||
(info->snd_assoc_id == SCTP_ALL_ASSOC)))) {
SCTP_INP_WLOCK(inp);
inp->def_send.sinfo_stream = info->snd_sid;
policy = PR_SCTP_POLICY(inp->def_send.sinfo_flags);
......@@ -7115,8 +7176,9 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
inp->def_send.sinfo_context = info->snd_context;
SCTP_INP_WUNLOCK(inp);
}
if ((info->snd_assoc_id == SCTP_CURRENT_ASSOC) ||
(info->snd_assoc_id == SCTP_ALL_ASSOC)) {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((info->snd_assoc_id == SCTP_CURRENT_ASSOC) ||
(info->snd_assoc_id == SCTP_ALL_ASSOC))) {
SCTP_INP_RLOCK(inp);
LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
SCTP_TCB_LOCK(stcb);
......@@ -7158,16 +7220,18 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(info->pr_assoc_id == SCTP_FUTURE_ASSOC) ||
(info->pr_assoc_id == SCTP_ALL_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((info->pr_assoc_id == SCTP_FUTURE_ASSOC) ||
(info->pr_assoc_id == SCTP_ALL_ASSOC)))) {
SCTP_INP_WLOCK(inp);
inp->def_send.sinfo_flags &= 0xfff0;
inp->def_send.sinfo_flags |= info->pr_policy;
inp->def_send.sinfo_timetolive = info->pr_value;
SCTP_INP_WUNLOCK(inp);
}
if ((info->pr_assoc_id == SCTP_CURRENT_ASSOC) ||
(info->pr_assoc_id == SCTP_ALL_ASSOC)) {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
((info->pr_assoc_id == SCTP_CURRENT_ASSOC) ||
(info->pr_assoc_id == SCTP_ALL_ASSOC))) {
SCTP_INP_RLOCK(inp);
LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
SCTP_TCB_LOCK(stcb);
......@@ -7351,7 +7415,8 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(thlds->spt_assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(thlds->spt_assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_WLOCK(inp);
inp->sctp_ep.def_net_failure = thlds->spt_pathmaxrxt;
inp->sctp_ep.def_net_pf_threshold = thlds->spt_pathpfthld;
......@@ -7464,7 +7529,8 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(encaps->sue_assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(encaps->sue_assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_WLOCK(inp);
inp->sctp_ep.port = encaps->sue_port;
SCTP_INP_WUNLOCK(inp);
......@@ -7489,7 +7555,8 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_WLOCK(inp);
if (av->assoc_value == 0) {
inp->ecn_supported = 0;
......@@ -7518,7 +7585,8 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_WLOCK(inp);
if (av->assoc_value == 0) {
inp->prsctp_supported = 0;
......@@ -7547,7 +7615,8 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
if ((av->assoc_value == 0) &&
(inp->asconf_supported == 1)) {
/* AUTH is required for ASCONF */
......@@ -7583,7 +7652,8 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
if ((av->assoc_value != 0) &&
(inp->auth_supported == 0)) {
/* AUTH is required for ASCONF */
......@@ -7627,7 +7697,8 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_WLOCK(inp);
if (av->assoc_value == 0) {
inp->reconfig_supported = 0;
......@@ -7656,7 +7727,8 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_WLOCK(inp);
if (av->assoc_value == 0) {
inp->nrsack_supported = 0;
......@@ -7685,7 +7757,8 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_WLOCK(inp);
if (av->assoc_value == 0) {
inp->pktdrop_supported = 0;
......@@ -7725,7 +7798,8 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
(av->assoc_id == SCTP_FUTURE_ASSOC)) {
((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
(av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_WLOCK(inp);
inp->max_cwnd = av->assoc_value;
SCTP_INP_WUNLOCK(inp);
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论