int mptcp_pm_announce_addr(struct mptcp_sock *msk,
const struct mptcp_addr_info *addr,
- bool echo)
+ bool echo, bool port)
{
u8 add_addr = READ_ONCE(msk->pm.add_addr_signal);
add_addr |= BIT(MPTCP_ADD_ADDR_ECHO);
if (addr->family == AF_INET6)
add_addr |= BIT(MPTCP_ADD_ADDR_IPV6);
+ if (port)
+ add_addr |= BIT(MPTCP_ADD_ADDR_PORT);
WRITE_ONCE(msk->pm.add_addr_signal, add_addr);
return 0;
}
spin_lock_bh(&pm->lock);
if (!READ_ONCE(pm->accept_addr)) {
- mptcp_pm_announce_addr(msk, addr, true);
+ mptcp_pm_announce_addr(msk, addr, true, addr->port);
mptcp_pm_add_addr_send_ack(msk);
} else if (mptcp_pm_schedule_work(msk, MPTCP_PM_ADD_ADDR_RECEIVED)) {
pm->remote = *addr;
if (!mptcp_pm_should_add_signal(msk)) {
pr_debug("retransmit ADD_ADDR id=%d", entry->addr.id);
- mptcp_pm_announce_addr(msk, &entry->addr, false);
+ mptcp_pm_announce_addr(msk, &entry->addr, false, entry->addr.port);
mptcp_pm_add_addr_send_ack(msk);
entry->retrans_times++;
}
if (local) {
if (mptcp_pm_alloc_anno_list(msk, local)) {
msk->pm.add_addr_signaled++;
- mptcp_pm_announce_addr(msk, &local->addr, false);
+ mptcp_pm_announce_addr(msk, &local->addr, false, local->addr.port);
mptcp_pm_nl_add_addr_send_ack(msk);
}
} else {
struct sock *sk = (struct sock *)msk;
struct mptcp_addr_info remote;
struct mptcp_addr_info local;
+ bool use_port = false;
pr_debug("accepted %d:%d remote family %d",
msk->pm.add_addr_accepted, msk->pm.add_addr_accept_max,
remote = msk->pm.remote;
if (!remote.port)
remote.port = sk->sk_dport;
+ else
+ use_port = true;
memset(&local, 0, sizeof(local));
local.family = remote.family;
__mptcp_subflow_connect((struct sock *)msk, &local, &remote);
spin_lock_bh(&msk->pm.lock);
- mptcp_pm_announce_addr(msk, &remote, true);
+ mptcp_pm_announce_addr(msk, &remote, true, use_port);
mptcp_pm_nl_add_addr_send_ack(msk);
}
int mptcp_pm_announce_addr(struct mptcp_sock *msk,
const struct mptcp_addr_info *addr,
- bool echo);
+ bool echo, bool port);
int mptcp_pm_remove_addr(struct mptcp_sock *msk, u8 local_id);
int mptcp_pm_remove_subflow(struct mptcp_sock *msk, u8 local_id);