diff options
author | Geliang Tang <geliangtang@gmail.com> | 2020-09-24 08:29:50 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-09-24 19:58:33 -0700 |
commit | 6a6c05a8b016bb5c63750f91cdb6d669b5a4b14f (patch) | |
tree | 53f5ef6d433502b618caed3755fae16c50294d9c /net/mptcp/pm.c | |
parent | d0876b2284cf8b34dd214b2d0aa21071c345da59 (diff) | |
download | linux-6a6c05a8b016bb5c63750f91cdb6d669b5a4b14f.tar.bz2 |
mptcp: send out ADD_ADDR with echo flag
When the ADD_ADDR suboption has been received, we need to send out the same
ADD_ADDR suboption with echo-flag=1, and no HMAC.
Suggested-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mptcp/pm.c')
-rw-r--r-- | net/mptcp/pm.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 558462d87eb3..39a76620d0a5 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -13,11 +13,13 @@ /* path manager command handlers */ int mptcp_pm_announce_addr(struct mptcp_sock *msk, - const struct mptcp_addr_info *addr) + const struct mptcp_addr_info *addr, + bool echo) { pr_debug("msk=%p, local_id=%d", msk, addr->id); msk->pm.local = *addr; + WRITE_ONCE(msk->pm.add_addr_echo, echo); WRITE_ONCE(msk->pm.add_addr_signal, true); return 0; } @@ -135,15 +137,11 @@ void mptcp_pm_add_addr_received(struct mptcp_sock *msk, pr_debug("msk=%p remote_id=%d accept=%d", msk, addr->id, READ_ONCE(pm->accept_addr)); - /* avoid acquiring the lock if there is no room for fouther addresses */ - if (!READ_ONCE(pm->accept_addr)) - return; - spin_lock_bh(&pm->lock); - /* be sure there is something to signal re-checking under PM lock */ - if (READ_ONCE(pm->accept_addr) && - mptcp_pm_schedule_work(msk, MPTCP_PM_ADD_ADDR_RECEIVED)) + if (!READ_ONCE(pm->accept_addr)) + mptcp_pm_announce_addr(msk, addr, true); + else if (mptcp_pm_schedule_work(msk, MPTCP_PM_ADD_ADDR_RECEIVED)) pm->remote = *addr; spin_unlock_bh(&pm->lock); @@ -164,7 +162,7 @@ void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, u8 rm_id) /* path manager helpers */ bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, unsigned int remaining, - struct mptcp_addr_info *saddr) + struct mptcp_addr_info *saddr, bool *echo) { int ret = false; @@ -178,6 +176,7 @@ bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, unsigned int remaining, goto out_unlock; *saddr = msk->pm.local; + *echo = READ_ONCE(msk->pm.add_addr_echo); WRITE_ONCE(msk->pm.add_addr_signal, false); ret = true; @@ -226,6 +225,7 @@ void mptcp_pm_data_init(struct mptcp_sock *msk) WRITE_ONCE(msk->pm.rm_addr_signal, false); WRITE_ONCE(msk->pm.accept_addr, false); WRITE_ONCE(msk->pm.accept_subflow, false); + WRITE_ONCE(msk->pm.add_addr_echo, false); msk->pm.status = 0; spin_lock_init(&msk->pm.lock); |