Skip to content

Commit

Permalink
mptcp: use adding up size to get ADD_ADDR length
Browse files Browse the repository at this point in the history
This patch uses adding up size to get the ADD_ADDR suboption length rather
than returning the ADD_ADDR size constants.

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 Nov 19, 2020
1 parent 033d49e commit 0d630ad
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions net/mptcp/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
#define TCPOLEN_MPTCP_ADD_ADDR6_BASE 20
#define TCPOLEN_MPTCP_ADD_ADDR6_BASE_PORT 24
#define TCPOLEN_MPTCP_PORT_LEN 4
#define TCPOLEN_MPTCP_ADD_ADDR_HMAC 8
#define TCPOLEN_MPTCP_RM_ADDR_BASE 4

/* MPTCP MP_JOIN flags */
Expand Down Expand Up @@ -553,10 +554,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 += TCPOLEN_MPTCP_ADD_ADDR_HMAC;

return len;
}

bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, unsigned int remaining,
Expand Down

0 comments on commit 0d630ad

Please sign in to comment.