mptcp: add port number check for MP_JOIN
authorGeliang Tang <geliangtang@gmail.com>
Mon, 1 Feb 2021 23:09:15 +0000 (15:09 -0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 3 Feb 2021 02:37:19 +0000 (18:37 -0800)
commit5bc56388c74f0e64b32e343ea603609b146dcb96
tree84d3e8660fe6a1a02b91dc2475acd269dc671860
parentec20e14396aeea26f6bf9221bce686a33bde9047
mptcp: add port number check for MP_JOIN

This patch adds two new helpers, subflow_use_different_sport and
subflow_use_different_dport, to check whether the subflow's source or
destination port number is different from the msk's port number. When
receiving the MP_JOIN's SYN/SYNACK/ACK, we do these port number checks
and print out the different port numbers.

And furthermore, when receiving the MP_JOIN's SYN/ACK, we also use a new
helper mptcp_pm_sport_in_anno_list to check whether this port number is
announced. If it isn't, we need to abort this connection.

This patch also populates the local address's port field in
local_address.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/mptcp/pm_netlink.c
net/mptcp/protocol.h
net/mptcp/subflow.c