diff mbox series

[mptcp-net] mptcp: allow changing the 'backup' bit when no sockets are open

Message ID db472a753375c011d3dc7b810262935473e481aa.1631821658.git.dcaratti@redhat.com (mailing list archive)
State Superseded, archived
Headers show
Series [mptcp-net] mptcp: allow changing the 'backup' bit when no sockets are open | expand

Commit Message

Davide Caratti Sept. 16, 2021, 7:52 p.m. UTC
current Linux refuses to change the 'backup' bit of MPTCP endpoints, i.e.
using MPTCP_PM_CMD_SET_FLAGS, unless it finds (at least) one subflow that
matches the endpoint address. There is no reason for that, so we can make
mptcp_nl_addr_backup() return without error even when 0 MPTCP sockets are
open and no MP_PRIO message is sent out.

Fixes: 0f9f696a502e ("mptcp: add set_flags command in PM netlink")
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
---
 net/mptcp/pm_netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mat Martineau Sept. 17, 2021, 1:11 a.m. UTC | #1
On Thu, 16 Sep 2021, Davide Caratti wrote:

> current Linux refuses to change the 'backup' bit of MPTCP endpoints, i.e.
> using MPTCP_PM_CMD_SET_FLAGS, unless it finds (at least) one subflow that
> matches the endpoint address. There is no reason for that, so we can make
> mptcp_nl_addr_backup() return without error even when 0 MPTCP sockets are
> open and no MP_PRIO message is sent out.
>
> Fixes: 0f9f696a502e ("mptcp: add set_flags command in PM netlink")
> Signed-off-by: Davide Caratti <dcaratti@redhat.com>
> ---
> net/mptcp/pm_netlink.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
> index c4f9a5ce3815..8a7048c5b9b4 100644
> --- a/net/mptcp/pm_netlink.c
> +++ b/net/mptcp/pm_netlink.c
> @@ -1678,7 +1678,7 @@ static int mptcp_nl_addr_backup(struct net *net,
> {
> 	long s_slot = 0, s_num = 0;
> 	struct mptcp_sock *msk;
> -	int ret = -EINVAL;
> +	int ret = 0;

Hi Davide & Geliang -

The ret value in mptcp_nl_addr_backup() can still get set to -EINVAL if 
mptcp_pm_nl_mp_prio_send_ack() returns that error and it happens to be the 
last token. So the error is not consistently propagated, and it doesn't 
seem like it's useful to propagate the -EINVAL to mptcp_nl_cmd_set_flags() 
anyway.

How about making mptcp_nl_cmd_set_flags() ignore the value returned by 
mptcp_nl_addr_backup()?

--
Mat Martineau
Intel
diff mbox series

Patch

diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index c4f9a5ce3815..8a7048c5b9b4 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -1678,7 +1678,7 @@  static int mptcp_nl_addr_backup(struct net *net,
 {
 	long s_slot = 0, s_num = 0;
 	struct mptcp_sock *msk;
-	int ret = -EINVAL;
+	int ret = 0;
 
 	while ((msk = mptcp_token_iter_next(net, &s_slot, &s_num)) != NULL) {
 		struct sock *sk = (struct sock *)msk;