diff options
| author | Matthieu Baerts (NGI0) <matttbe@kernel.org> | 2024-07-27 12:01:28 +0200 | 
|---|---|---|
| committer | Paolo Abeni <pabeni@redhat.com> | 2024-07-30 10:27:30 +0200 | 
| commit | 6834097fc38c5416701c793da94558cea49c0a1f (patch) | |
| tree | 819f07d69be352b553b2ad9866e3d53abd2bc689 /net/mptcp/pm_userspace.c | |
| parent | 935ff5bb8a1cfcdf8e60c8f5c794d0bbbc234437 (diff) | |
mptcp: pm: fix backup support in signal endpoints
There was a support for signal endpoints, but only when the endpoint's
flag was changed during a connection. If an endpoint with the signal and
backup was already present, the MP_JOIN reply was not containing the
backup flag as expected.
That's confusing to have this inconsistent behaviour. On the other hand,
the infrastructure to set the backup flag in the SYN + ACK + MP_JOIN was
already there, it was just never set before. Now when requesting the
local ID from the path-manager, the backup status is also requested.
Note that when the userspace PM is used, the backup flag can be set if
the local address was already used before with a backup flag, e.g. if
the address was announced with the 'backup' flag, or a subflow was
created with the 'backup' flag.
Fixes: 4596a2c1b7f5 ("mptcp: allow creating non-backup subflows")
Cc: stable@vger.kernel.org
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/507
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/mptcp/pm_userspace.c')
| -rw-r--r-- | net/mptcp/pm_userspace.c | 18 | 
1 files changed, 18 insertions, 0 deletions
diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index f0a4590506c6..8eaa9fbe3e34 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -165,6 +165,24 @@ int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk,  	return mptcp_userspace_pm_append_new_local_addr(msk, &new_entry, true);  } +bool mptcp_userspace_pm_is_backup(struct mptcp_sock *msk, +				  struct mptcp_addr_info *skc) +{ +	struct mptcp_pm_addr_entry *entry; +	bool backup = false; + +	spin_lock_bh(&msk->pm.lock); +	list_for_each_entry(entry, &msk->pm.userspace_pm_local_addr_list, list) { +		if (mptcp_addresses_equal(&entry->addr, skc, false)) { +			backup = !!(entry->flags & MPTCP_PM_ADDR_FLAG_BACKUP); +			break; +		} +	} +	spin_unlock_bh(&msk->pm.lock); + +	return backup; +} +  int mptcp_pm_nl_announce_doit(struct sk_buff *skb, struct genl_info *info)  {  	struct nlattr *token = info->attrs[MPTCP_PM_ATTR_TOKEN];  | 
