Commit acce7f3b authored by Xin Long's avatar Xin Long Committed by David S. Miller

sctp: use SCTP_FUTURE_ASSOC for SCTP_RECONFIG_SUPPORTED sockopt

Check with SCTP_FUTURE_ASSOC instead in
sctp_set/getsockopt_reconfig_supported, it's compatible with 0.

It also adjusts some code to keep a same check form as other functions.
Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fb195605
...@@ -4041,15 +4041,14 @@ static int sctp_setsockopt_reconfig_supported(struct sock *sk, ...@@ -4041,15 +4041,14 @@ static int sctp_setsockopt_reconfig_supported(struct sock *sk,
} }
asoc = sctp_id2assoc(sk, params.assoc_id); asoc = sctp_id2assoc(sk, params.assoc_id);
if (asoc) { if (!asoc && params.assoc_id != SCTP_FUTURE_ASSOC &&
asoc->reconf_enable = !!params.assoc_value; sctp_style(sk, UDP))
} else if (!params.assoc_id) {
struct sctp_sock *sp = sctp_sk(sk);
sp->ep->reconf_enable = !!params.assoc_value;
} else {
goto out; goto out;
}
if (asoc)
asoc->reconf_enable = !!params.assoc_value;
else
sctp_sk(sk)->ep->reconf_enable = !!params.assoc_value;
retval = 0; retval = 0;
...@@ -7295,17 +7294,15 @@ static int sctp_getsockopt_reconfig_supported(struct sock *sk, int len, ...@@ -7295,17 +7294,15 @@ static int sctp_getsockopt_reconfig_supported(struct sock *sk, int len,
goto out; goto out;
asoc = sctp_id2assoc(sk, params.assoc_id); asoc = sctp_id2assoc(sk, params.assoc_id);
if (asoc) { if (!asoc && params.assoc_id != SCTP_FUTURE_ASSOC &&
params.assoc_value = asoc->reconf_enable; sctp_style(sk, UDP)) {
} else if (!params.assoc_id) {
struct sctp_sock *sp = sctp_sk(sk);
params.assoc_value = sp->ep->reconf_enable;
} else {
retval = -EINVAL; retval = -EINVAL;
goto out; goto out;
} }
params.assoc_value = asoc ? asoc->reconf_enable
: sctp_sk(sk)->ep->reconf_enable;
if (put_user(len, optlen)) if (put_user(len, optlen))
goto out; goto out;
......
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