Skip to content

Commit

Permalink
mptcp: enable use_port when invoke addresses_equal
Browse files Browse the repository at this point in the history
When dealing with the addresses list local_addr_list or anno_list, we
should enable the function addresses_equal's parameter use_port. And
enable it in address_zero too.

Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
  • Loading branch information
geliangtang authored and matttbe committed Jan 16, 2021
1 parent 751e3f6 commit 3f96f48
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions net/mptcp/pm_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ static bool address_zero(const struct mptcp_addr_info *addr)
memset(&zero, 0, sizeof(zero));
zero.family = addr->family;

return addresses_equal(addr, &zero, false);
return addresses_equal(addr, &zero, true);
}

static void local_address(const struct sock_common *skc,
Expand Down Expand Up @@ -131,7 +131,7 @@ static bool lookup_subflow_by_saddr(const struct list_head *list,
skc = (struct sock_common *)mptcp_subflow_tcp_sock(subflow);

local_address(skc, &cur);
if (addresses_equal(&cur, saddr, false))
if (addresses_equal(&cur, saddr, saddr->port))
return true;
}

Expand Down Expand Up @@ -244,7 +244,7 @@ lookup_anno_list_by_saddr(struct mptcp_sock *msk,
struct mptcp_pm_add_entry *entry;

list_for_each_entry(entry, &msk->pm.anno_list, list) {
if (addresses_equal(&entry->addr, addr, false))
if (addresses_equal(&entry->addr, addr, true))
return entry;
}

Expand Down Expand Up @@ -772,7 +772,7 @@ int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct sock_common *skc)

rcu_read_lock();
list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) {
if (addresses_equal(&entry->addr, &skc_local, false)) {
if (addresses_equal(&entry->addr, &skc_local, entry->addr.port)) {
ret = entry->addr.id;
break;
}
Expand Down

0 comments on commit 3f96f48

Please sign in to comment.