Skip to content

Commit 09355f7

Browse files
matttbekuba-moo
authored andcommitted
mptcp: pm: fullmesh: select the right ID later
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") Cc: [email protected] Reviewed-by: Mat Martineau <[email protected]> Signed-off-by: Matthieu Baerts (NGI0) <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent ca6e55a commit 09355f7

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

net/mptcp/pm_netlink.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,13 +636,16 @@ static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk,
636636
{
637637
struct sock *sk = (struct sock *)msk;
638638
struct mptcp_pm_addr_entry *entry;
639+
struct mptcp_addr_info mpc_addr;
639640
struct pm_nl_pernet *pernet;
640641
unsigned int subflows_max;
641642
int i = 0;
642643

643644
pernet = pm_nl_get_pernet_from_msk(msk);
644645
subflows_max = mptcp_pm_get_subflows_max(msk);
645646

647+
mptcp_local_address((struct sock_common *)msk, &mpc_addr);
648+
646649
rcu_read_lock();
647650
list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) {
648651
if (!(entry->flags & MPTCP_PM_ADDR_FLAG_FULLMESH))
@@ -653,7 +656,13 @@ static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk,
653656

654657
if (msk->pm.subflows < subflows_max) {
655658
msk->pm.subflows++;
656-
addrs[i++] = entry->addr;
659+
addrs[i] = entry->addr;
660+
661+
/* Special case for ID0: set the correct ID */
662+
if (mptcp_addresses_equal(&entry->addr, &mpc_addr, entry->addr.port))
663+
addrs[i].id = 0;
664+
665+
i++;
657666
}
658667
}
659668
rcu_read_unlock();

0 commit comments

Comments
 (0)