Commit 7c614682 authored by David S. Miller's avatar David S. Miller

Merge branch 'sctp-fix-ignoring-asoc_id-for-tcp-style-sockets-on-some-setsockopts'

Xin Long says:

====================
sctp: fix ignoring asoc_id for tcp-style sockets on some setsockopts

This is a patchset to fix ignoring asoc_id for tcp-style sockets on
some setsockopts, introduced by SCTP_CURRENT_ASSOC of the patchset:

  [net-next,00/24] sctp: support SCTP_FUTURE/CURRENT/ALL_ASSOC
  (https://patchwork.ozlabs.org/cover/1031706/)

As Marcelo suggested, we fix it on each setsockopt that is using
SCTP_CURRENT_ASSOC one by one by adding the check:

    if (sctp_style(sk, TCP))
        	xxx.xxx_assoc_id = SCTP_FUTURE_ASSOC;

so that assoc_id will be completely ingored for tcp-style socket on
setsockopts, and works as SCTP_FUTURE_ASSOC.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 636d25d5 b59c19d9
...@@ -2920,6 +2920,9 @@ static int sctp_setsockopt_delayed_ack(struct sock *sk, ...@@ -2920,6 +2920,9 @@ static int sctp_setsockopt_delayed_ack(struct sock *sk,
return 0; return 0;
} }
if (sctp_style(sk, TCP))
params.sack_assoc_id = SCTP_FUTURE_ASSOC;
if (params.sack_assoc_id == SCTP_FUTURE_ASSOC || if (params.sack_assoc_id == SCTP_FUTURE_ASSOC ||
params.sack_assoc_id == SCTP_ALL_ASSOC) { params.sack_assoc_id == SCTP_ALL_ASSOC) {
if (params.sack_delay) { if (params.sack_delay) {
...@@ -3024,6 +3027,9 @@ static int sctp_setsockopt_default_send_param(struct sock *sk, ...@@ -3024,6 +3027,9 @@ static int sctp_setsockopt_default_send_param(struct sock *sk,
return 0; return 0;
} }
if (sctp_style(sk, TCP))
info.sinfo_assoc_id = SCTP_FUTURE_ASSOC;
if (info.sinfo_assoc_id == SCTP_FUTURE_ASSOC || if (info.sinfo_assoc_id == SCTP_FUTURE_ASSOC ||
info.sinfo_assoc_id == SCTP_ALL_ASSOC) { info.sinfo_assoc_id == SCTP_ALL_ASSOC) {
sp->default_stream = info.sinfo_stream; sp->default_stream = info.sinfo_stream;
...@@ -3081,6 +3087,9 @@ static int sctp_setsockopt_default_sndinfo(struct sock *sk, ...@@ -3081,6 +3087,9 @@ static int sctp_setsockopt_default_sndinfo(struct sock *sk,
return 0; return 0;
} }
if (sctp_style(sk, TCP))
info.snd_assoc_id = SCTP_FUTURE_ASSOC;
if (info.snd_assoc_id == SCTP_FUTURE_ASSOC || if (info.snd_assoc_id == SCTP_FUTURE_ASSOC ||
info.snd_assoc_id == SCTP_ALL_ASSOC) { info.snd_assoc_id == SCTP_ALL_ASSOC) {
sp->default_stream = info.snd_sid; sp->default_stream = info.snd_sid;
...@@ -3531,6 +3540,9 @@ static int sctp_setsockopt_context(struct sock *sk, char __user *optval, ...@@ -3531,6 +3540,9 @@ static int sctp_setsockopt_context(struct sock *sk, char __user *optval,
return 0; return 0;
} }
if (sctp_style(sk, TCP))
params.assoc_id = SCTP_FUTURE_ASSOC;
if (params.assoc_id == SCTP_FUTURE_ASSOC || if (params.assoc_id == SCTP_FUTURE_ASSOC ||
params.assoc_id == SCTP_ALL_ASSOC) params.assoc_id == SCTP_ALL_ASSOC)
sp->default_rcv_context = params.assoc_value; sp->default_rcv_context = params.assoc_value;
...@@ -3670,6 +3682,9 @@ static int sctp_setsockopt_maxburst(struct sock *sk, ...@@ -3670,6 +3682,9 @@ static int sctp_setsockopt_maxburst(struct sock *sk,
return 0; return 0;
} }
if (sctp_style(sk, TCP))
params.assoc_id = SCTP_FUTURE_ASSOC;
if (params.assoc_id == SCTP_FUTURE_ASSOC || if (params.assoc_id == SCTP_FUTURE_ASSOC ||
params.assoc_id == SCTP_ALL_ASSOC) params.assoc_id == SCTP_ALL_ASSOC)
sp->max_burst = params.assoc_value; sp->max_burst = params.assoc_value;
...@@ -3798,6 +3813,9 @@ static int sctp_setsockopt_auth_key(struct sock *sk, ...@@ -3798,6 +3813,9 @@ static int sctp_setsockopt_auth_key(struct sock *sk,
goto out; goto out;
} }
if (sctp_style(sk, TCP))
authkey->sca_assoc_id = SCTP_FUTURE_ASSOC;
if (authkey->sca_assoc_id == SCTP_FUTURE_ASSOC || if (authkey->sca_assoc_id == SCTP_FUTURE_ASSOC ||
authkey->sca_assoc_id == SCTP_ALL_ASSOC) { authkey->sca_assoc_id == SCTP_ALL_ASSOC) {
ret = sctp_auth_set_key(ep, asoc, authkey); ret = sctp_auth_set_key(ep, asoc, authkey);
...@@ -3853,6 +3871,9 @@ static int sctp_setsockopt_active_key(struct sock *sk, ...@@ -3853,6 +3871,9 @@ static int sctp_setsockopt_active_key(struct sock *sk,
if (asoc) if (asoc)
return sctp_auth_set_active_key(ep, asoc, val.scact_keynumber); return sctp_auth_set_active_key(ep, asoc, val.scact_keynumber);
if (sctp_style(sk, TCP))
val.scact_assoc_id = SCTP_FUTURE_ASSOC;
if (val.scact_assoc_id == SCTP_FUTURE_ASSOC || if (val.scact_assoc_id == SCTP_FUTURE_ASSOC ||
val.scact_assoc_id == SCTP_ALL_ASSOC) { val.scact_assoc_id == SCTP_ALL_ASSOC) {
ret = sctp_auth_set_active_key(ep, asoc, val.scact_keynumber); ret = sctp_auth_set_active_key(ep, asoc, val.scact_keynumber);
...@@ -3904,6 +3925,9 @@ static int sctp_setsockopt_del_key(struct sock *sk, ...@@ -3904,6 +3925,9 @@ static int sctp_setsockopt_del_key(struct sock *sk,
if (asoc) if (asoc)
return sctp_auth_del_key_id(ep, asoc, val.scact_keynumber); return sctp_auth_del_key_id(ep, asoc, val.scact_keynumber);
if (sctp_style(sk, TCP))
val.scact_assoc_id = SCTP_FUTURE_ASSOC;
if (val.scact_assoc_id == SCTP_FUTURE_ASSOC || if (val.scact_assoc_id == SCTP_FUTURE_ASSOC ||
val.scact_assoc_id == SCTP_ALL_ASSOC) { val.scact_assoc_id == SCTP_ALL_ASSOC) {
ret = sctp_auth_del_key_id(ep, asoc, val.scact_keynumber); ret = sctp_auth_del_key_id(ep, asoc, val.scact_keynumber);
...@@ -3954,6 +3978,9 @@ static int sctp_setsockopt_deactivate_key(struct sock *sk, char __user *optval, ...@@ -3954,6 +3978,9 @@ static int sctp_setsockopt_deactivate_key(struct sock *sk, char __user *optval,
if (asoc) if (asoc)
return sctp_auth_deact_key_id(ep, asoc, val.scact_keynumber); return sctp_auth_deact_key_id(ep, asoc, val.scact_keynumber);
if (sctp_style(sk, TCP))
val.scact_assoc_id = SCTP_FUTURE_ASSOC;
if (val.scact_assoc_id == SCTP_FUTURE_ASSOC || if (val.scact_assoc_id == SCTP_FUTURE_ASSOC ||
val.scact_assoc_id == SCTP_ALL_ASSOC) { val.scact_assoc_id == SCTP_ALL_ASSOC) {
ret = sctp_auth_deact_key_id(ep, asoc, val.scact_keynumber); ret = sctp_auth_deact_key_id(ep, asoc, val.scact_keynumber);
...@@ -4169,6 +4196,9 @@ static int sctp_setsockopt_default_prinfo(struct sock *sk, ...@@ -4169,6 +4196,9 @@ static int sctp_setsockopt_default_prinfo(struct sock *sk,
goto out; goto out;
} }
if (sctp_style(sk, TCP))
info.pr_assoc_id = SCTP_FUTURE_ASSOC;
if (info.pr_assoc_id == SCTP_FUTURE_ASSOC || if (info.pr_assoc_id == SCTP_FUTURE_ASSOC ||
info.pr_assoc_id == SCTP_ALL_ASSOC) { info.pr_assoc_id == SCTP_ALL_ASSOC) {
SCTP_PR_SET_POLICY(sp->default_flags, info.pr_policy); SCTP_PR_SET_POLICY(sp->default_flags, info.pr_policy);
...@@ -4251,6 +4281,9 @@ static int sctp_setsockopt_enable_strreset(struct sock *sk, ...@@ -4251,6 +4281,9 @@ static int sctp_setsockopt_enable_strreset(struct sock *sk,
goto out; goto out;
} }
if (sctp_style(sk, TCP))
params.assoc_id = SCTP_FUTURE_ASSOC;
if (params.assoc_id == SCTP_FUTURE_ASSOC || if (params.assoc_id == SCTP_FUTURE_ASSOC ||
params.assoc_id == SCTP_ALL_ASSOC) params.assoc_id == SCTP_ALL_ASSOC)
ep->strreset_enable = params.assoc_value; ep->strreset_enable = params.assoc_value;
...@@ -4376,6 +4409,9 @@ static int sctp_setsockopt_scheduler(struct sock *sk, ...@@ -4376,6 +4409,9 @@ static int sctp_setsockopt_scheduler(struct sock *sk,
if (asoc) if (asoc)
return sctp_sched_set_sched(asoc, params.assoc_value); return sctp_sched_set_sched(asoc, params.assoc_value);
if (sctp_style(sk, TCP))
params.assoc_id = SCTP_FUTURE_ASSOC;
if (params.assoc_id == SCTP_FUTURE_ASSOC || if (params.assoc_id == SCTP_FUTURE_ASSOC ||
params.assoc_id == SCTP_ALL_ASSOC) params.assoc_id == SCTP_ALL_ASSOC)
sp->default_ss = params.assoc_value; sp->default_ss = params.assoc_value;
...@@ -4541,6 +4577,9 @@ static int sctp_setsockopt_event(struct sock *sk, char __user *optval, ...@@ -4541,6 +4577,9 @@ static int sctp_setsockopt_event(struct sock *sk, char __user *optval,
if (asoc) if (asoc)
return sctp_assoc_ulpevent_type_set(&param, asoc); return sctp_assoc_ulpevent_type_set(&param, asoc);
if (sctp_style(sk, TCP))
param.se_assoc_id = SCTP_FUTURE_ASSOC;
if (param.se_assoc_id == SCTP_FUTURE_ASSOC || if (param.se_assoc_id == SCTP_FUTURE_ASSOC ||
param.se_assoc_id == SCTP_ALL_ASSOC) param.se_assoc_id == SCTP_ALL_ASSOC)
sctp_ulpevent_type_set(&sp->subscribe, sctp_ulpevent_type_set(&sp->subscribe,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment