diff options
author | Geliang Tang <geliangtang@gmail.com> | 2020-12-09 15:51:22 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-12-09 19:02:15 -0800 |
commit | 4a2777a83406cc87edf08b5c71887d896f628525 (patch) | |
tree | 9e0e8e3844dbf29f033d42420150cf1810687bad /net/mptcp/options.c | |
parent | 2ec72faec86bc92c573fc3bada8001115670da44 (diff) | |
download | lwn-4a2777a83406cc87edf08b5c71887d896f628525.tar.gz lwn-4a2777a83406cc87edf08b5c71887d896f628525.zip |
mptcp: add the outgoing ADD_ADDR port support
This patch added a new add_addr_signal type named MPTCP_ADD_ADDR_PORT,
to identify it is an address with port to be added.
It also added a new parameter 'port' for both mptcp_add_addr_len and
mptcp_pm_add_addr_signal.
In mptcp_established_options_add_addr, we check whether the announced
address is added with port. If it is, we put this port number to
mptcp_out_options's port field.
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/options.c')
-rw-r--r-- | net/mptcp/options.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/net/mptcp/options.c b/net/mptcp/options.c index f841128a86c6..faae58cc7330 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -587,6 +587,7 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff * unsigned int opt_size = *size; struct mptcp_addr_info saddr; bool echo; + bool port; int len; if (mptcp_pm_should_add_signal_ipv6(msk) && @@ -598,10 +599,10 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff * } if (!mptcp_pm_should_add_signal(msk) || - !(mptcp_pm_add_addr_signal(msk, remaining, &saddr, &echo))) + !(mptcp_pm_add_addr_signal(msk, remaining, &saddr, &echo, &port))) return false; - len = mptcp_add_addr_len(saddr.family, echo); + len = mptcp_add_addr_len(saddr.family, echo, port); if (remaining < len) return false; @@ -609,6 +610,8 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff * if (drop_other_suboptions) *size -= opt_size; opts->addr_id = saddr.id; + if (port) + opts->port = ntohs(saddr.port); if (saddr.family == AF_INET) { opts->suboptions |= OPTION_MPTCP_ADD_ADDR; opts->addr = saddr.addr; @@ -631,7 +634,8 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff * } } #endif - pr_debug("addr_id=%d, ahmac=%llu, echo=%d", opts->addr_id, opts->ahmac, echo); + pr_debug("addr_id=%d, ahmac=%llu, echo=%d, port=%d", + opts->addr_id, opts->ahmac, echo, opts->port); return true; } |