aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2019-03-18 21:31:09 -0400
committerDavid S. Miller <davem@davemloft.net>2019-03-18 21:31:09 -0400
commit7c614682c8aed5f401ad84a18669c1ef602ad33d (patch)
tree6956cf767bcc0f3b4993eaae5cd9b079d9f8d85a
parent636d25d557d1073281013c43e4ff4737692da2d4 (diff)
parentb59c19d9d901a8eb04896ec027787a55acb71fc6 (diff)
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: David S. Miller <davem@davemloft.net>
-rw-r--r--net/sctp/socket.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 65b538604c5b..011c349d877a 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -2920,6 +2920,9 @@ static int sctp_setsockopt_delayed_ack(struct sock *sk,
2920 return 0; 2920 return 0;
2921 } 2921 }
2922 2922
2923 if (sctp_style(sk, TCP))
2924 params.sack_assoc_id = SCTP_FUTURE_ASSOC;
2925
2923 if (params.sack_assoc_id == SCTP_FUTURE_ASSOC || 2926 if (params.sack_assoc_id == SCTP_FUTURE_ASSOC ||
2924 params.sack_assoc_id == SCTP_ALL_ASSOC) { 2927 params.sack_assoc_id == SCTP_ALL_ASSOC) {
2925 if (params.sack_delay) { 2928 if (params.sack_delay) {
@@ -3024,6 +3027,9 @@ static int sctp_setsockopt_default_send_param(struct sock *sk,
3024 return 0; 3027 return 0;
3025 } 3028 }
3026 3029
3030 if (sctp_style(sk, TCP))
3031 info.sinfo_assoc_id = SCTP_FUTURE_ASSOC;
3032
3027 if (info.sinfo_assoc_id == SCTP_FUTURE_ASSOC || 3033 if (info.sinfo_assoc_id == SCTP_FUTURE_ASSOC ||
3028 info.sinfo_assoc_id == SCTP_ALL_ASSOC) { 3034 info.sinfo_assoc_id == SCTP_ALL_ASSOC) {
3029 sp->default_stream = info.sinfo_stream; 3035 sp->default_stream = info.sinfo_stream;
@@ -3081,6 +3087,9 @@ static int sctp_setsockopt_default_sndinfo(struct sock *sk,
3081 return 0; 3087 return 0;
3082 } 3088 }
3083 3089
3090 if (sctp_style(sk, TCP))
3091 info.snd_assoc_id = SCTP_FUTURE_ASSOC;
3092
3084 if (info.snd_assoc_id == SCTP_FUTURE_ASSOC || 3093 if (info.snd_assoc_id == SCTP_FUTURE_ASSOC ||
3085 info.snd_assoc_id == SCTP_ALL_ASSOC) { 3094 info.snd_assoc_id == SCTP_ALL_ASSOC) {
3086 sp->default_stream = info.snd_sid; 3095 sp->default_stream = info.snd_sid;
@@ -3531,6 +3540,9 @@ static int sctp_setsockopt_context(struct sock *sk, char __user *optval,
3531 return 0; 3540 return 0;
3532 } 3541 }
3533 3542
3543 if (sctp_style(sk, TCP))
3544 params.assoc_id = SCTP_FUTURE_ASSOC;
3545
3534 if (params.assoc_id == SCTP_FUTURE_ASSOC || 3546 if (params.assoc_id == SCTP_FUTURE_ASSOC ||
3535 params.assoc_id == SCTP_ALL_ASSOC) 3547 params.assoc_id == SCTP_ALL_ASSOC)
3536 sp->default_rcv_context = params.assoc_value; 3548 sp->default_rcv_context = params.assoc_value;
@@ -3670,6 +3682,9 @@ static int sctp_setsockopt_maxburst(struct sock *sk,
3670 return 0; 3682 return 0;
3671 } 3683 }
3672 3684
3685 if (sctp_style(sk, TCP))
3686 params.assoc_id = SCTP_FUTURE_ASSOC;
3687
3673 if (params.assoc_id == SCTP_FUTURE_ASSOC || 3688 if (params.assoc_id == SCTP_FUTURE_ASSOC ||
3674 params.assoc_id == SCTP_ALL_ASSOC) 3689 params.assoc_id == SCTP_ALL_ASSOC)
3675 sp->max_burst = params.assoc_value; 3690 sp->max_burst = params.assoc_value;
@@ -3798,6 +3813,9 @@ static int sctp_setsockopt_auth_key(struct sock *sk,
3798 goto out; 3813 goto out;
3799 } 3814 }
3800 3815
3816 if (sctp_style(sk, TCP))
3817 authkey->sca_assoc_id = SCTP_FUTURE_ASSOC;
3818
3801 if (authkey->sca_assoc_id == SCTP_FUTURE_ASSOC || 3819 if (authkey->sca_assoc_id == SCTP_FUTURE_ASSOC ||
3802 authkey->sca_assoc_id == SCTP_ALL_ASSOC) { 3820 authkey->sca_assoc_id == SCTP_ALL_ASSOC) {
3803 ret = sctp_auth_set_key(ep, asoc, authkey); 3821 ret = sctp_auth_set_key(ep, asoc, authkey);
@@ -3853,6 +3871,9 @@ static int sctp_setsockopt_active_key(struct sock *sk,
3853 if (asoc) 3871 if (asoc)
3854 return sctp_auth_set_active_key(ep, asoc, val.scact_keynumber); 3872 return sctp_auth_set_active_key(ep, asoc, val.scact_keynumber);
3855 3873
3874 if (sctp_style(sk, TCP))
3875 val.scact_assoc_id = SCTP_FUTURE_ASSOC;
3876
3856 if (val.scact_assoc_id == SCTP_FUTURE_ASSOC || 3877 if (val.scact_assoc_id == SCTP_FUTURE_ASSOC ||
3857 val.scact_assoc_id == SCTP_ALL_ASSOC) { 3878 val.scact_assoc_id == SCTP_ALL_ASSOC) {
3858 ret = sctp_auth_set_active_key(ep, asoc, val.scact_keynumber); 3879 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 if (asoc) 3925 if (asoc)
3905 return sctp_auth_del_key_id(ep, asoc, val.scact_keynumber); 3926 return sctp_auth_del_key_id(ep, asoc, val.scact_keynumber);
3906 3927
3928 if (sctp_style(sk, TCP))
3929 val.scact_assoc_id = SCTP_FUTURE_ASSOC;
3930
3907 if (val.scact_assoc_id == SCTP_FUTURE_ASSOC || 3931 if (val.scact_assoc_id == SCTP_FUTURE_ASSOC ||
3908 val.scact_assoc_id == SCTP_ALL_ASSOC) { 3932 val.scact_assoc_id == SCTP_ALL_ASSOC) {
3909 ret = sctp_auth_del_key_id(ep, asoc, val.scact_keynumber); 3933 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 if (asoc) 3978 if (asoc)
3955 return sctp_auth_deact_key_id(ep, asoc, val.scact_keynumber); 3979 return sctp_auth_deact_key_id(ep, asoc, val.scact_keynumber);
3956 3980
3981 if (sctp_style(sk, TCP))
3982 val.scact_assoc_id = SCTP_FUTURE_ASSOC;
3983
3957 if (val.scact_assoc_id == SCTP_FUTURE_ASSOC || 3984 if (val.scact_assoc_id == SCTP_FUTURE_ASSOC ||
3958 val.scact_assoc_id == SCTP_ALL_ASSOC) { 3985 val.scact_assoc_id == SCTP_ALL_ASSOC) {
3959 ret = sctp_auth_deact_key_id(ep, asoc, val.scact_keynumber); 3986 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 goto out; 4196 goto out;
4170 } 4197 }
4171 4198
4199 if (sctp_style(sk, TCP))
4200 info.pr_assoc_id = SCTP_FUTURE_ASSOC;
4201
4172 if (info.pr_assoc_id == SCTP_FUTURE_ASSOC || 4202 if (info.pr_assoc_id == SCTP_FUTURE_ASSOC ||
4173 info.pr_assoc_id == SCTP_ALL_ASSOC) { 4203 info.pr_assoc_id == SCTP_ALL_ASSOC) {
4174 SCTP_PR_SET_POLICY(sp->default_flags, info.pr_policy); 4204 SCTP_PR_SET_POLICY(sp->default_flags, info.pr_policy);
@@ -4251,6 +4281,9 @@ static int sctp_setsockopt_enable_strreset(struct sock *sk,
4251 goto out; 4281 goto out;
4252 } 4282 }
4253 4283
4284 if (sctp_style(sk, TCP))
4285 params.assoc_id = SCTP_FUTURE_ASSOC;
4286
4254 if (params.assoc_id == SCTP_FUTURE_ASSOC || 4287 if (params.assoc_id == SCTP_FUTURE_ASSOC ||
4255 params.assoc_id == SCTP_ALL_ASSOC) 4288 params.assoc_id == SCTP_ALL_ASSOC)
4256 ep->strreset_enable = params.assoc_value; 4289 ep->strreset_enable = params.assoc_value;
@@ -4376,6 +4409,9 @@ static int sctp_setsockopt_scheduler(struct sock *sk,
4376 if (asoc) 4409 if (asoc)
4377 return sctp_sched_set_sched(asoc, params.assoc_value); 4410 return sctp_sched_set_sched(asoc, params.assoc_value);
4378 4411
4412 if (sctp_style(sk, TCP))
4413 params.assoc_id = SCTP_FUTURE_ASSOC;
4414
4379 if (params.assoc_id == SCTP_FUTURE_ASSOC || 4415 if (params.assoc_id == SCTP_FUTURE_ASSOC ||
4380 params.assoc_id == SCTP_ALL_ASSOC) 4416 params.assoc_id == SCTP_ALL_ASSOC)
4381 sp->default_ss = params.assoc_value; 4417 sp->default_ss = params.assoc_value;
@@ -4541,6 +4577,9 @@ static int sctp_setsockopt_event(struct sock *sk, char __user *optval,
4541 if (asoc) 4577 if (asoc)
4542 return sctp_assoc_ulpevent_type_set(&param, asoc); 4578 return sctp_assoc_ulpevent_type_set(&param, asoc);
4543 4579
4580 if (sctp_style(sk, TCP))
4581 param.se_assoc_id = SCTP_FUTURE_ASSOC;
4582
4544 if (param.se_assoc_id == SCTP_FUTURE_ASSOC || 4583 if (param.se_assoc_id == SCTP_FUTURE_ASSOC ||
4545 param.se_assoc_id == SCTP_ALL_ASSOC) 4584 param.se_assoc_id == SCTP_ALL_ASSOC)
4546 sctp_ulpevent_type_set(&sp->subscribe, 4585 sctp_ulpevent_type_set(&sp->subscribe,