Skip to content

Commit

Permalink
mptcp: pm: fullmesh: select the right ID later
Browse files Browse the repository at this point in the history
When reacting upon the reception of an ADD_ADDR, the in-kernel PM first
looks for fullmesh endpoints. If there are some, it will pick them,
using their entry ID.

It should set the ID 0 when using the endpoint corresponding to the
initial subflow, it is a special case imposed by the MPTCP specs.

Note that msk->mpc_endpoint_id might not be set when receiving the first
ADD_ADDR from the server. So better to compare the addresses.

Fixes: 1a0d613 ("mptcp: local addresses fullmesh")
Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
  • Loading branch information
matttbe authored and intel-lab-lkp committed Jul 19, 2024
1 parent dcbe296 commit b121f0e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion net/mptcp/pm_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,12 +637,14 @@ static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk,
{
struct sock *sk = (struct sock *)msk;
struct mptcp_pm_addr_entry *entry;
struct mptcp_addr_info mpc_addr;
struct pm_nl_pernet *pernet;
unsigned int subflows_max;
int i = 0;

pernet = pm_nl_get_pernet_from_msk(msk);
subflows_max = mptcp_pm_get_subflows_max(msk);
mptcp_local_address((struct sock_common *)msk->first, &mpc_addr);

rcu_read_lock();
list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) {
Expand All @@ -654,7 +656,13 @@ static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk,

if (msk->pm.subflows < subflows_max) {
msk->pm.subflows++;
addrs[i++] = entry->addr;
addrs[i] = entry->addr;

/* Special case for ID0: set the correct endpoint */
if (mptcp_addresses_equal(&entry->addr, &mpc_addr, entry->addr.port))
addrs[i].id = 0;

i++;
}
}
rcu_read_unlock();
Expand Down

0 comments on commit b121f0e

Please sign in to comment.