Merge branch 'sctp-support-SCTP_FUTURE-CURRENT-ALL_ASSOC'
Xin Long says: ==================== sctp: support SCTP_FUTURE/CURRENT/ALL_ASSOC This patchset adds the support for 3 assoc_id constants: SCTP_FUTURE_ASSOC SCTP_CURRENT_ASSOC, SCTP_ALL_ASSOC, described in rfc6458#section-7.2: All socket options set on a one-to-one style listening socket also apply to all future accepted sockets. For one-to-many style sockets, often a socket option will pass a structure that includes an assoc_id field. This field can be filled with the association identifier of a particular association and unless otherwise specified can be filled with one of the following constants: SCTP_FUTURE_ASSOC: Specifies that only future associations created after this socket option will be affected by this call. SCTP_CURRENT_ASSOC: Specifies that only currently existing associations will be affected by this call, and future associations will still receive the previous default value. SCTP_ALL_ASSOC: Specifies that all current and future associations will be affected by this call. The functions for many other sockopts that use assoc_id also need to be updated accordingly. ==================== Acked-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
804a15cdbb
|
@ -199,6 +199,8 @@ struct sctp_sock {
|
||||||
__u32 flowlabel;
|
__u32 flowlabel;
|
||||||
__u8 dscp;
|
__u8 dscp;
|
||||||
|
|
||||||
|
int pf_retrans;
|
||||||
|
|
||||||
/* The initial Path MTU to use for new associations. */
|
/* The initial Path MTU to use for new associations. */
|
||||||
__u32 pathmtu;
|
__u32 pathmtu;
|
||||||
|
|
||||||
|
@ -209,6 +211,8 @@ struct sctp_sock {
|
||||||
/* Flags controlling Heartbeat, SACK delay, and Path MTU Discovery. */
|
/* Flags controlling Heartbeat, SACK delay, and Path MTU Discovery. */
|
||||||
__u32 param_flags;
|
__u32 param_flags;
|
||||||
|
|
||||||
|
__u32 default_ss;
|
||||||
|
|
||||||
struct sctp_rtoinfo rtoinfo;
|
struct sctp_rtoinfo rtoinfo;
|
||||||
struct sctp_paddrparams paddrparam;
|
struct sctp_paddrparams paddrparam;
|
||||||
struct sctp_assocparams assocparams;
|
struct sctp_assocparams assocparams;
|
||||||
|
|
|
@ -59,6 +59,10 @@
|
||||||
|
|
||||||
typedef __s32 sctp_assoc_t;
|
typedef __s32 sctp_assoc_t;
|
||||||
|
|
||||||
|
#define SCTP_FUTURE_ASSOC 0
|
||||||
|
#define SCTP_CURRENT_ASSOC 1
|
||||||
|
#define SCTP_ALL_ASSOC 2
|
||||||
|
|
||||||
/* The following symbols come from the Sockets API Extensions for
|
/* The following symbols come from the Sockets API Extensions for
|
||||||
* SCTP <draft-ietf-tsvwg-sctpsocket-07.txt>.
|
* SCTP <draft-ietf-tsvwg-sctpsocket-07.txt>.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -101,7 +101,7 @@ static struct sctp_association *sctp_association_init(
|
||||||
* socket values.
|
* socket values.
|
||||||
*/
|
*/
|
||||||
asoc->max_retrans = sp->assocparams.sasoc_asocmaxrxt;
|
asoc->max_retrans = sp->assocparams.sasoc_asocmaxrxt;
|
||||||
asoc->pf_retrans = net->sctp.pf_retrans;
|
asoc->pf_retrans = sp->pf_retrans;
|
||||||
|
|
||||||
asoc->rto_initial = msecs_to_jiffies(sp->rtoinfo.srto_initial);
|
asoc->rto_initial = msecs_to_jiffies(sp->rtoinfo.srto_initial);
|
||||||
asoc->rto_max = msecs_to_jiffies(sp->rtoinfo.srto_max);
|
asoc->rto_max = msecs_to_jiffies(sp->rtoinfo.srto_max);
|
||||||
|
@ -1651,8 +1651,11 @@ int sctp_assoc_set_id(struct sctp_association *asoc, gfp_t gfp)
|
||||||
if (preload)
|
if (preload)
|
||||||
idr_preload(gfp);
|
idr_preload(gfp);
|
||||||
spin_lock_bh(&sctp_assocs_id_lock);
|
spin_lock_bh(&sctp_assocs_id_lock);
|
||||||
/* 0 is not a valid assoc_id, must be >= 1 */
|
/* 0, 1, 2 are used as SCTP_FUTURE_ASSOC, SCTP_CURRENT_ASSOC and
|
||||||
ret = idr_alloc_cyclic(&sctp_assocs_id, asoc, 1, 0, GFP_NOWAIT);
|
* SCTP_ALL_ASSOC, so an available id must be > SCTP_ALL_ASSOC.
|
||||||
|
*/
|
||||||
|
ret = idr_alloc_cyclic(&sctp_assocs_id, asoc, SCTP_ALL_ASSOC + 1, 0,
|
||||||
|
GFP_NOWAIT);
|
||||||
spin_unlock_bh(&sctp_assocs_id_lock);
|
spin_unlock_bh(&sctp_assocs_id_lock);
|
||||||
if (preload)
|
if (preload)
|
||||||
idr_preload_end();
|
idr_preload_end();
|
||||||
|
|
|
@ -212,7 +212,7 @@ void sctp_outq_init(struct sctp_association *asoc, struct sctp_outq *q)
|
||||||
INIT_LIST_HEAD(&q->retransmit);
|
INIT_LIST_HEAD(&q->retransmit);
|
||||||
INIT_LIST_HEAD(&q->sacked);
|
INIT_LIST_HEAD(&q->sacked);
|
||||||
INIT_LIST_HEAD(&q->abandoned);
|
INIT_LIST_HEAD(&q->abandoned);
|
||||||
sctp_sched_set_sched(asoc, SCTP_SS_DEFAULT);
|
sctp_sched_set_sched(asoc, sctp_sk(asoc->base.sk)->default_ss);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free the outqueue structure and any related pending chunks.
|
/* Free the outqueue structure and any related pending chunks.
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue