diff options
author | Geliang Tang <geliangtang@gmail.com> | 2020-12-09 15:51:21 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-12-09 19:02:15 -0800 |
commit | 2ec72faec86bc92c573fc3bada8001115670da44 (patch) | |
tree | 396aed3adc0048e9a27c87820eb48945b7cfe4f5 /net/mptcp | |
parent | 22fb85ffaefb80a22c815008a500273b3f61bba3 (diff) | |
download | lwn-2ec72faec86bc92c573fc3bada8001115670da44.tar.gz lwn-2ec72faec86bc92c573fc3bada8001115670da44.zip |
mptcp: use adding up size to get ADD_ADDR length
This patch uses adding up size to get the ADD_ADDR suboption length rather
than returning the ADD_ADDR size constants.
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mptcp')
-rw-r--r-- | net/mptcp/protocol.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 9032174b446a..9315f6a8343a 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -577,10 +577,14 @@ static inline bool mptcp_pm_should_rm_signal(struct mptcp_sock *msk) static inline unsigned int mptcp_add_addr_len(int family, bool echo) { - if (family == AF_INET) - return echo ? TCPOLEN_MPTCP_ADD_ADDR_BASE - : TCPOLEN_MPTCP_ADD_ADDR; - return echo ? TCPOLEN_MPTCP_ADD_ADDR6_BASE : TCPOLEN_MPTCP_ADD_ADDR6; + u8 len = TCPOLEN_MPTCP_ADD_ADDR_BASE; + + if (family == AF_INET6) + len = TCPOLEN_MPTCP_ADD_ADDR6_BASE; + if (!echo) + len += MPTCPOPT_THMAC_LEN; + + return len; } bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, unsigned int remaining, |