diff options
author | Matthieu Baerts <matthieu.baerts@tessares.net> | 2020-10-03 17:36:56 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-10-03 17:36:37 -0700 |
commit | 456afe01b10085518406022c69cfd2b718d6eaf8 (patch) | |
tree | 0dedcb7f27912743dbbeb007bc07f10ce32c9198 /net/mptcp/protocol.h | |
parent | 3a56268ef6ee7c065520e1d73c58dbd2c2c5f3c2 (diff) |
mptcp: ADD_ADDRs with echo bit are smaller
The MPTCP ADD_ADDR suboption with echo-flag=1 has no HMAC, the size is
smaller than the one initially sent without echo-flag=1. We then need to
use the correct size everywhere when we need this echo bit.
Before this patch, the wrong size was reserved but the correct amount of
bytes were written (and read): the remaining bytes contained garbage.
Fixes: 6a6c05a8b016 ("mptcp: send out ADD_ADDR with echo flag")
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/95
Reported-and-tested-by: Davide Caratti <dcaratti@redhat.com>
Acked-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mptcp/protocol.h')
-rw-r--r-- | net/mptcp/protocol.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 7cfe52aeb2b8..6eef4db9ee5c 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -464,11 +464,12 @@ static inline bool mptcp_pm_should_rm_signal(struct mptcp_sock *msk) return READ_ONCE(msk->pm.rm_addr_signal); } -static inline unsigned int mptcp_add_addr_len(int family) +static inline unsigned int mptcp_add_addr_len(int family, bool echo) { if (family == AF_INET) - return TCPOLEN_MPTCP_ADD_ADDR; - return TCPOLEN_MPTCP_ADD_ADDR6; + return echo ? TCPOLEN_MPTCP_ADD_ADDR_BASE + : TCPOLEN_MPTCP_ADD_ADDR; + return echo ? TCPOLEN_MPTCP_ADD_ADDR6_BASE : TCPOLEN_MPTCP_ADD_ADDR6; } bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, unsigned int remaining, |