Author: tuexen
Date: Fri Feb 10 22:49:09 2012
New Revision: 231458
URL: http://svn.freebsd.org/changeset/base/231458

Log:
  MFC r224918:
  Fix the handling of [gs]etsockopt() unconnected 1-to-1 style sockets.
  While there:
  * Fix a locking issue in setsockopt() of SCTP_CMT_ON_OFF.
  * Fix a bug in setsockopt() of SCTP_DEFAULT_PRINFO, where the pr_value
    was ignored.

Modified:
  stable/8/sys/netinet/sctp_usrreq.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/boot/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/e1000/   (props changed)

Modified: stable/8/sys/netinet/sctp_usrreq.c
==============================================================================
--- stable/8/sys/netinet/sctp_usrreq.c  Fri Feb 10 22:44:36 2012        
(r231457)
+++ stable/8/sys/netinet/sctp_usrreq.c  Fri Feb 10 22:49:09 2012        
(r231458)
@@ -1767,7 +1767,9 @@ flags_out:
                                av->assoc_value = stcb->asoc.sctp_cmt_on_off;
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if (av->assoc_id == SCTP_FUTURE_ASSOC) {
+                               if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
+                                   (inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
+                                   (av->assoc_id == SCTP_FUTURE_ASSOC)) {
                                        SCTP_INP_RLOCK(inp);
                                        av->assoc_value = inp->sctp_cmt_on_off;
                                        SCTP_INP_RUNLOCK(inp);
@@ -1791,7 +1793,9 @@ flags_out:
                                av->assoc_value = 
stcb->asoc.congestion_control_module;
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if (av->assoc_id == SCTP_FUTURE_ASSOC) {
+                               if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
+                                   (inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
+                                   (av->assoc_id == SCTP_FUTURE_ASSOC)) {
                                        SCTP_INP_RLOCK(inp);
                                        av->assoc_value = 
inp->sctp_ep.sctp_default_cc_module;
                                        SCTP_INP_RUNLOCK(inp);
@@ -1834,7 +1838,9 @@ flags_out:
                                av->assoc_value = 
stcb->asoc.stream_scheduling_module;
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if (av->assoc_id == SCTP_FUTURE_ASSOC) {
+                               if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
+                                   (inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
+                                   (av->assoc_id == SCTP_FUTURE_ASSOC)) {
                                        SCTP_INP_RLOCK(inp);
                                        av->assoc_value = 
inp->sctp_ep.sctp_default_ss_module;
                                        SCTP_INP_RUNLOCK(inp);
@@ -1949,7 +1955,9 @@ flags_out:
                                av->assoc_value = stcb->asoc.context;
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if (av->assoc_id == SCTP_FUTURE_ASSOC) {
+                               if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
+                                   (inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
+                                   (av->assoc_id == SCTP_FUTURE_ASSOC)) {
                                        SCTP_INP_RLOCK(inp);
                                        av->assoc_value = inp->sctp_context;
                                        SCTP_INP_RUNLOCK(inp);
@@ -2022,7 +2030,9 @@ flags_out:
                                sack->sack_freq = stcb->asoc.sack_freq;
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if (sack->sack_assoc_id == SCTP_FUTURE_ASSOC) {
+                               if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
+                                   (inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
+                                   (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;
@@ -2084,7 +2094,9 @@ flags_out:
                                av->assoc_value = sctp_get_frag_point(stcb, 
&stcb->asoc);
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if (av->assoc_id == SCTP_FUTURE_ASSOC) {
+                               if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
+                                   (inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
+                                   (av->assoc_id == SCTP_FUTURE_ASSOC)) {
                                        SCTP_INP_RLOCK(inp);
                                        if (inp->sctp_flags & 
SCTP_PCB_FLAGS_BOUND_V6) {
                                                ovh = SCTP_MED_OVERHEAD;
@@ -2453,7 +2465,9 @@ flags_out:
                                paddrp->spp_assoc_id = sctp_get_associd(stcb);
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if (paddrp->spp_assoc_id == SCTP_FUTURE_ASSOC) {
+                               if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
+                                   (inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
+                                   (paddrp->spp_assoc_id == 
SCTP_FUTURE_ASSOC)) {
                                        /* Use endpoint defaults */
                                        SCTP_INP_RLOCK(inp);
                                        paddrp->spp_pathmaxrxt = 
inp->sctp_ep.def_net_failure;
@@ -2628,7 +2642,9 @@ flags_out:
                                srto->srto_min = stcb->asoc.minrto;
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if (srto->srto_assoc_id == SCTP_FUTURE_ASSOC) {
+                               if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
+                                   (inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
+                                   (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;
@@ -2682,7 +2698,9 @@ flags_out:
                                sasoc->sasoc_local_rwnd = stcb->asoc.my_rwnd;
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if (sasoc->sasoc_assoc_id == SCTP_FUTURE_ASSOC) 
{
+                               if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
+                                   (inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
+                                   (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;
@@ -2711,7 +2729,9 @@ flags_out:
                                memcpy(s_info, &stcb->asoc.def_send, 
sizeof(stcb->asoc.def_send));
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if (s_info->sinfo_assoc_id == 
SCTP_FUTURE_ASSOC) {
+                               if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
+                                   (inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
+                                   (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);
@@ -2813,7 +2833,9 @@ flags_out:
                                scact->scact_keynumber = 
stcb->asoc.authinfo.active_keyid;
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if (scact->scact_assoc_id == SCTP_FUTURE_ASSOC) 
{
+                               if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
+                                   (inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
+                                   (scact->scact_assoc_id == 
SCTP_FUTURE_ASSOC)) {
                                        /* get the endpoint active key */
                                        SCTP_INP_RLOCK(inp);
                                        scact->scact_keynumber = 
inp->sctp_ep.default_keyid;
@@ -2852,7 +2874,9 @@ flags_out:
                                }
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if (sac->gauth_assoc_id == SCTP_FUTURE_ASSOC) {
+                               if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
+                                   (inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
+                                   (sac->gauth_assoc_id == SCTP_FUTURE_ASSOC)) 
{
                                        /* get off the endpoint */
                                        SCTP_INP_RLOCK(inp);
                                        chklist = 
inp->sctp_ep.local_auth_chunks;
@@ -2958,7 +2982,9 @@ flags_out:
                                        event->se_on = 
sctp_stcb_is_feature_on(inp, stcb, event_type);
                                        SCTP_TCB_UNLOCK(stcb);
                                } else {
-                                       if (event->se_assoc_id == 
SCTP_FUTURE_ASSOC) {
+                                       if ((inp->sctp_flags & 
SCTP_PCB_FLAGS_TCPTYPE) ||
+                                           (inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
+                                           (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);
@@ -3026,7 +3052,9 @@ flags_out:
                                info->snd_context = 
stcb->asoc.def_send.sinfo_context;
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if (info->snd_assoc_id == SCTP_FUTURE_ASSOC) {
+                               if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
+                                   (inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
+                                   (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;
@@ -3056,7 +3084,9 @@ flags_out:
                                info->pr_value = 
stcb->asoc.def_send.sinfo_timetolive;
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if (info->pr_assoc_id == SCTP_FUTURE_ASSOC) {
+                               if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
+                                   (inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
+                                   (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;
@@ -3144,7 +3174,9 @@ flags_out:
                                thlds->spt_assoc_id = sctp_get_associd(stcb);
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if (thlds->spt_assoc_id == SCTP_FUTURE_ASSOC) {
+                               if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
+                                   (inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
+                                   (thlds->spt_assoc_id == SCTP_FUTURE_ASSOC)) 
{
                                        /* Use endpoint defaults */
                                        SCTP_INP_RLOCK(inp);
                                        thlds->spt_pathmaxrxt = 
inp->sctp_ep.def_net_failure;
@@ -3338,7 +3370,9 @@ sctp_setopt(struct socket *so, int optna
                                stcb->asoc.sctp_cmt_on_off = av->assoc_value;
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if ((av->assoc_id == SCTP_FUTURE_ASSOC) ||
+                               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)) {
                                        SCTP_INP_WLOCK(inp);
                                        inp->sctp_cmt_on_off = av->assoc_value;
@@ -3351,8 +3385,8 @@ sctp_setopt(struct socket *so, int optna
                                                SCTP_TCB_LOCK(stcb);
                                                stcb->asoc.sctp_cmt_on_off = 
av->assoc_value;
                                                SCTP_TCB_UNLOCK(stcb);
-                                               SCTP_INP_RUNLOCK(inp);
                                        }
+                                       SCTP_INP_RUNLOCK(inp);
                                }
                        }
                } else {
@@ -3385,7 +3419,9 @@ sctp_setopt(struct socket *so, int optna
                                }
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if ((av->assoc_id == SCTP_FUTURE_ASSOC) ||
+                               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)) {
                                        SCTP_INP_WLOCK(inp);
                                        inp->sctp_ep.sctp_default_cc_module = 
av->assoc_value;
@@ -3465,7 +3501,9 @@ sctp_setopt(struct socket *so, int optna
                                stcb->asoc.ss_functions.sctp_ss_init(stcb, 
&stcb->asoc, 1);
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if ((av->assoc_id == SCTP_FUTURE_ASSOC) ||
+                               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)) {
                                        SCTP_INP_WLOCK(inp);
                                        inp->sctp_ep.sctp_default_ss_module = 
av->assoc_value;
@@ -3539,7 +3577,9 @@ sctp_setopt(struct socket *so, int optna
                                stcb->asoc.context = av->assoc_value;
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if ((av->assoc_id == SCTP_FUTURE_ASSOC) ||
+                               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)) {
                                        SCTP_INP_WLOCK(inp);
                                        inp->sctp_context = av->assoc_value;
@@ -3605,7 +3645,9 @@ sctp_setopt(struct socket *so, int optna
                                }
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if ((sack->sack_assoc_id == SCTP_FUTURE_ASSOC) 
||
+                               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)) {
                                        SCTP_INP_WLOCK(inp);
                                        if (sack->sack_delay) {
@@ -3700,7 +3742,9 @@ sctp_setopt(struct socket *so, int optna
                                error = sctp_insert_sharedkey(shared_keys, 
shared_key);
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if ((sca->sca_assoc_id == SCTP_FUTURE_ASSOC) ||
+                               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)) {
                                        SCTP_INP_WLOCK(inp);
                                        shared_keys = &inp->sctp_ep.shared_keys;
@@ -3844,7 +3888,9 @@ sctp_setopt(struct socket *so, int optna
                                }
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if ((scact->scact_assoc_id == 
SCTP_FUTURE_ASSOC) ||
+                               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)) {
                                        SCTP_INP_WLOCK(inp);
                                        if (sctp_auth_setactivekey_ep(inp, 
scact->scact_keynumber)) {
@@ -3881,7 +3927,9 @@ sctp_setopt(struct socket *so, int optna
                                }
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if ((scdel->scact_assoc_id == 
SCTP_FUTURE_ASSOC) ||
+                               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)) {
                                        SCTP_INP_WLOCK(inp);
                                        if (sctp_delete_sharedkey_ep(inp, 
scdel->scact_keynumber)) {
@@ -3918,7 +3966,9 @@ sctp_setopt(struct socket *so, int optna
                                }
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if ((keyid->scact_assoc_id == 
SCTP_FUTURE_ASSOC) ||
+                               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)) {
                                        SCTP_INP_WLOCK(inp);
                                        if (sctp_deact_sharedkey_ep(inp, 
keyid->scact_keynumber)) {
@@ -4205,7 +4255,9 @@ sctp_setopt(struct socket *so, int optna
                                }
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if (av->assoc_id == SCTP_FUTURE_ASSOC) {
+                               if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
+                                   (inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
+                                   (av->assoc_id == SCTP_FUTURE_ASSOC)) {
                                        SCTP_INP_WLOCK(inp);
                                        /*
                                         * FIXME MT: I think this is not in
@@ -4413,7 +4465,9 @@ sctp_setopt(struct socket *so, int optna
                                }
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if ((s_info->sinfo_assoc_id == 
SCTP_FUTURE_ASSOC) ||
+                               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)) 
{
                                        SCTP_INP_WLOCK(inp);
                                        memcpy(&inp->def_send, s_info, 
min(optsize, sizeof(inp->def_send)));
@@ -4712,7 +4766,9 @@ sctp_setopt(struct socket *so, int optna
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
                                /************************NO TCB, SET TO default 
stuff ******************/
-                               if (paddrp->spp_assoc_id == SCTP_FUTURE_ASSOC) {
+                               if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
+                                   (inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
+                                   (paddrp->spp_assoc_id == 
SCTP_FUTURE_ASSOC)) {
                                        SCTP_INP_WLOCK(inp);
                                        /*
                                         * For the TOS/FLOWLABEL stuff you
@@ -4778,7 +4834,9 @@ sctp_setopt(struct socket *so, int optna
                                }
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if (srto->srto_assoc_id == SCTP_FUTURE_ASSOC) {
+                               if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
+                                   (inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
+                                   (srto->srto_assoc_id == SCTP_FUTURE_ASSOC)) 
{
                                        SCTP_INP_WLOCK(inp);
                                        if (srto->srto_initial)
                                                new_init = srto->srto_initial;
@@ -4830,7 +4888,9 @@ sctp_setopt(struct socket *so, int optna
                                }
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if (sasoc->sasoc_assoc_id == SCTP_FUTURE_ASSOC) 
{
+                               if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
+                                   (inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
+                                   (sasoc->sasoc_assoc_id == 
SCTP_FUTURE_ASSOC)) {
                                        SCTP_INP_WLOCK(inp);
                                        if (sasoc->sasoc_asocmaxrxt)
                                                inp->sctp_ep.max_send_times = 
sasoc->sasoc_asocmaxrxt;
@@ -5150,13 +5210,17 @@ sctp_setopt(struct socket *so, int optna
                                         * 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) &&
                                            ((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);
                                                error = ENOTSUP;
                                                break;
                                        }
-                                       if ((event->se_assoc_id == 
SCTP_FUTURE_ASSOC) ||
+                                       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)) {
                                                SCTP_INP_WLOCK(inp);
                                                if (event->se_on) {
@@ -5234,7 +5298,9 @@ sctp_setopt(struct socket *so, int optna
                                }
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if ((info->snd_assoc_id == SCTP_FUTURE_ASSOC) ||
+                               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)) {
                                        SCTP_INP_WLOCK(inp);
                                        inp->def_send.sinfo_stream = 
info->snd_sid;
@@ -5280,13 +5346,17 @@ sctp_setopt(struct socket *so, int optna
                        if (stcb) {
                                stcb->asoc.def_send.sinfo_flags &= 0xfff0;
                                stcb->asoc.def_send.sinfo_flags |= 
info->pr_policy;
+                               stcb->asoc.def_send.sinfo_timetolive = 
info->pr_value;
                                SCTP_TCB_UNLOCK(stcb);
                        } else {
-                               if ((info->pr_assoc_id == SCTP_FUTURE_ASSOC) ||
+                               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)) {
                                        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) ||
@@ -5296,6 +5366,7 @@ sctp_setopt(struct socket *so, int optna
                                                SCTP_TCB_LOCK(stcb);
                                                stcb->asoc.def_send.sinfo_flags 
&= 0xfff0;
                                                stcb->asoc.def_send.sinfo_flags 
|= info->pr_policy;
+                                               
stcb->asoc.def_send.sinfo_timetolive = info->pr_value;
                                                SCTP_TCB_UNLOCK(stcb);
                                        }
                                        SCTP_INP_RUNLOCK(inp);
@@ -5431,7 +5502,9 @@ sctp_setopt(struct socket *so, int optna
                                        stcb->asoc.def_net_pf_threshold = 
thlds->spt_pathpfthld;
                                }
                        } else {
-                               if (thlds->spt_assoc_id == SCTP_FUTURE_ASSOC) {
+                               if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
+                                   (inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
+                                   (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;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to