From patchwork Wed Jul 7 17:01:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: YonglongLi X-Patchwork-Id: 12363073 Received: from chinatelecom.cn (prt-mail.chinatelecom.cn [42.123.76.228]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EF7B4177 for ; Wed, 7 Jul 2021 17:09:19 +0000 (UTC) HMM_SOURCE_IP: 172.18.0.218:54022.267134115 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-36.111.140.9?logid-436ef2b3ccc547e0a5ea08a54c44f662 (unknown [172.18.0.218]) by chinatelecom.cn (HERMES) with SMTP id 4B7B82800C3; Thu, 8 Jul 2021 01:01:55 +0800 (CST) X-189-SAVE-TO-SEND: +liyonglong@chinatelecom.cn Received: from ([172.18.0.218]) by app0025 with ESMTP id 6f88457e6b824790beb76decc0499d23 for mptcp@lists.linux.dev; Thu Jul 8 01:01:57 2021 X-Transaction-ID: 6f88457e6b824790beb76decc0499d23 X-filter-score: X-Real-From: liyonglong@chinatelecom.cn X-Receive-IP: 172.18.0.218 X-MEDUSA-Status: 0 Sender: liyonglong@chinatelecom.cn From: Yonglong Li To: mptcp@lists.linux.dev Cc: mathew.j.martineau@linux.intel.com, geliangtang@gmail.com, Yonglong Li Subject: [PATCH v8 1/4] mptcp: make MPTCP_ADD_ADDR_SIGNAL and MPTCP_ADD_ADDR_ECHO separate Date: Thu, 8 Jul 2021 01:01:38 +0800 Message-Id: <1625677301-139357-2-git-send-email-liyonglong@chinatelecom.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1625677301-139357-1-git-send-email-liyonglong@chinatelecom.cn> References: <1625677301-139357-1-git-send-email-liyonglong@chinatelecom.cn> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 MPTCP_ADD_ADDR_SIGNAL only for action of sending ADD_ADDR MPTCP_ADD_ADDR_ECHO only for action of sending echo ADD_ADDR add a mptcp_addr_info in struct mptcp_out_options for echo ADD_ADDR to prepare for the next patch. Signed-off-by: Yonglong Li --- net/mptcp/pm.c | 16 ++++++++++------ net/mptcp/pm_netlink.c | 4 ++-- net/mptcp/protocol.h | 6 ++++++ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 9d00fa6..1b357ea 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -18,19 +18,23 @@ int mptcp_pm_announce_addr(struct mptcp_sock *msk, { u8 add_addr = READ_ONCE(msk->pm.addr_signal); - pr_debug("msk=%p, local_id=%d", msk, addr->id); + pr_debug("msk=%p, local_id=%d, echo:%d", msk, addr->id, echo); lockdep_assert_held(&msk->pm.lock); - if (add_addr) { - pr_warn("addr_signal error, add_addr=%d", add_addr); + if (add_addr & + (echo ? BIT(MPTCP_ADD_ADDR_ECHO) : BIT(MPTCP_ADD_ADDR_SIGNAL))) { + pr_warn("addr_signal error, add_addr=%d, echo=%d", add_addr, echo); return -EINVAL; } - msk->pm.local = *addr; - add_addr |= BIT(MPTCP_ADD_ADDR_SIGNAL); - if (echo) + if (echo) { + msk->pm.remote = *addr; add_addr |= BIT(MPTCP_ADD_ADDR_ECHO); + } else { + msk->pm.local = *addr; + add_addr |= BIT(MPTCP_ADD_ADDR_SIGNAL); + } if (addr->family == AF_INET6) add_addr |= BIT(MPTCP_ADD_ADDR_IPV6); if (addr->port) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index d4732a4..0f302d2 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -317,14 +317,14 @@ static void mptcp_pm_add_timer(struct timer_list *timer) if (!entry->addr.id) return; - if (mptcp_pm_should_add_signal(msk)) { + if (mptcp_pm_should_add_signal_addr(msk)) { sk_reset_timer(sk, timer, jiffies + TCP_RTO_MAX / 8); goto out; } spin_lock_bh(&msk->pm.lock); - if (!mptcp_pm_should_add_signal(msk)) { + if (!mptcp_pm_should_add_signal_addr(msk)) { pr_debug("retransmit ADD_ADDR id=%d", entry->addr.id); mptcp_pm_announce_addr(msk, &entry->addr, false); mptcp_pm_add_addr_send_ack(msk); diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 160c2ab..a0b0ec0 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -708,6 +708,12 @@ void mptcp_event(enum mptcp_event_type type, const struct mptcp_sock *msk, static inline bool mptcp_pm_should_add_signal(struct mptcp_sock *msk) { + return READ_ONCE(msk->pm.addr_signal) & + (BIT(MPTCP_ADD_ADDR_SIGNAL) | BIT(MPTCP_ADD_ADDR_ECHO)); +} + +static inline bool mptcp_pm_should_add_signal_addr(struct mptcp_sock *msk) +{ return READ_ONCE(msk->pm.addr_signal) & BIT(MPTCP_ADD_ADDR_SIGNAL); } From patchwork Wed Jul 7 17:01:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: YonglongLi X-Patchwork-Id: 12363059 Received: from chinatelecom.cn (prt-mail.chinatelecom.cn [42.123.76.228]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C9BB32FAD for ; Wed, 7 Jul 2021 17:02:04 +0000 (UTC) HMM_SOURCE_IP: 172.18.0.218:54022.267134115 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-36.111.140.9?logid-436ef2b3ccc547e0a5ea08a54c44f662 (unknown [172.18.0.218]) by chinatelecom.cn (HERMES) with SMTP id 5B5FB2800DA; Thu, 8 Jul 2021 01:01:59 +0800 (CST) X-189-SAVE-TO-SEND: +liyonglong@chinatelecom.cn Received: from ([172.18.0.218]) by app0025 with ESMTP id cece9fce4d134afe9a3fcbbb4a01584f for mptcp@lists.linux.dev; Thu Jul 8 01:02:04 2021 X-Transaction-ID: cece9fce4d134afe9a3fcbbb4a01584f X-filter-score: X-Real-From: liyonglong@chinatelecom.cn X-Receive-IP: 172.18.0.218 X-MEDUSA-Status: 0 Sender: liyonglong@chinatelecom.cn From: Yonglong Li To: mptcp@lists.linux.dev Cc: mathew.j.martineau@linux.intel.com, geliangtang@gmail.com, Yonglong Li Subject: [PATCH v8 2/4] mptcp: fix ADD_ADDR and RM_ADDR maybe flush addr_signal each other Date: Thu, 8 Jul 2021 01:01:39 +0800 Message-Id: <1625677301-139357-3-git-send-email-liyonglong@chinatelecom.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1625677301-139357-1-git-send-email-liyonglong@chinatelecom.cn> References: <1625677301-139357-1-git-send-email-liyonglong@chinatelecom.cn> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 ADD_ADDR share pm.addr_signal with RM_ADDR, so after RM_ADDR/ADD_ADDR done we should not clean ADD_ADDR/RM_ADDR's addr_signal. Signed-off-by: Yonglong Li --- net/mptcp/pm.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 1b357ea..6a91189 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -271,7 +271,10 @@ bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, unsigned int remaining, goto out_unlock; *saddr = msk->pm.local; - WRITE_ONCE(msk->pm.addr_signal, 0); + if ((msk->pm.addr_signal & BIT(MPTCP_ADD_ADDR_ECHO))) + WRITE_ONCE(msk->pm.addr_signal, msk->pm.addr_signal & ~BIT(MPTCP_ADD_ADDR_ECHO)); + else + WRITE_ONCE(msk->pm.addr_signal, msk->pm.addr_signal & ~BIT(MPTCP_ADD_ADDR_SIGNAL)); ret = true; out_unlock: @@ -283,6 +286,7 @@ bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining, struct mptcp_rm_list *rm_list) { int ret = false, len; + u8 rm_addr; spin_lock_bh(&msk->pm.lock); @@ -290,16 +294,17 @@ bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining, if (!mptcp_pm_should_rm_signal(msk)) goto out_unlock; + rm_addr = msk->pm.addr_signal & ~BIT(MPTCP_RM_ADDR_SIGNAL); len = mptcp_rm_addr_len(&msk->pm.rm_list_tx); if (len < 0) { - WRITE_ONCE(msk->pm.addr_signal, 0); + WRITE_ONCE(msk->pm.addr_signal, rm_addr); goto out_unlock; } if (remaining < len) goto out_unlock; *rm_list = msk->pm.rm_list_tx; - WRITE_ONCE(msk->pm.addr_signal, 0); + WRITE_ONCE(msk->pm.addr_signal, rm_addr); ret = true; out_unlock: From patchwork Wed Jul 7 17:01:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: YonglongLi X-Patchwork-Id: 12363061 Received: from chinatelecom.cn (prt-mail.chinatelecom.cn [42.123.76.228]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6460572 for ; Wed, 7 Jul 2021 17:02:10 +0000 (UTC) HMM_SOURCE_IP: 172.18.0.218:54022.267134115 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-36.111.140.9?logid-436ef2b3ccc547e0a5ea08a54c44f662 (unknown [172.18.0.218]) by chinatelecom.cn (HERMES) with SMTP id A56A82800DD; Thu, 8 Jul 2021 01:02:06 +0800 (CST) X-189-SAVE-TO-SEND: +liyonglong@chinatelecom.cn Received: from ([172.18.0.218]) by app0025 with ESMTP id b9c920d6a4d1428ca5ba1444f939b94c for mptcp@lists.linux.dev; Thu Jul 8 01:02:11 2021 X-Transaction-ID: b9c920d6a4d1428ca5ba1444f939b94c X-filter-score: X-Real-From: liyonglong@chinatelecom.cn X-Receive-IP: 172.18.0.218 X-MEDUSA-Status: 0 Sender: liyonglong@chinatelecom.cn From: Yonglong Li To: mptcp@lists.linux.dev Cc: mathew.j.martineau@linux.intel.com, geliangtang@gmail.com, Yonglong Li Subject: [PATCH v8 3/4] mptcp: build ADD_ADDR/echo-ADD_ADDR option according pm.add_signal Date: Thu, 8 Jul 2021 01:01:40 +0800 Message-Id: <1625677301-139357-4-git-send-email-liyonglong@chinatelecom.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1625677301-139357-1-git-send-email-liyonglong@chinatelecom.cn> References: <1625677301-139357-1-git-send-email-liyonglong@chinatelecom.cn> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 according MPTCP_ADD_ADDR_SIGNAL and MPTCP_ADD_ADDR_ECHO flag build ADD_ADDR/echo-ADD_ADDR option add a suboptions type OPTION_MPTCP_ADD_ECHO to mark as echo option Signed-off-by: Yonglong Li --- include/net/mptcp.h | 3 ++- net/mptcp/options.c | 51 ++++++++++++++++++++++++++++----------------------- net/mptcp/pm.c | 20 ++++++++++++++------ net/mptcp/protocol.h | 26 ++++++++++++++++++-------- 4 files changed, 62 insertions(+), 38 deletions(-) diff --git a/include/net/mptcp.h b/include/net/mptcp.h index d61bbbf..d2c6ebe 100644 --- a/include/net/mptcp.h +++ b/include/net/mptcp.h @@ -61,7 +61,8 @@ struct mptcp_out_options { u64 sndr_key; u64 rcvr_key; u64 ahmac; - struct mptcp_addr_info addr; + struct mptcp_addr_info local; + struct mptcp_addr_info remote; struct mptcp_rm_list rm_list; u8 join_id; u8 backup; diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 1aec016..de20312 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -655,13 +655,16 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff * struct mptcp_sock *msk = mptcp_sk(subflow->conn); bool drop_other_suboptions = false; unsigned int opt_size = *size; - bool echo; - bool port; + u8 add_addr; int len; - if ((mptcp_pm_should_add_signal_ipv6(msk) || - mptcp_pm_should_add_signal_port(msk) || - mptcp_pm_should_add_signal_echo(msk)) && + if (!mptcp_pm_should_add_signal(msk) || + !mptcp_pm_add_addr_signal(msk, skb, opt_size, remaining, opts, &add_addr)) + return false; + + if (((add_addr & BIT(MPTCP_ADD_ADDR_ECHO)) || + ((add_addr & BIT(MPTCP_ADD_ADDR_SIGNAL)) && + (opts->local.family == AF_INET6 || opts->local.port))) && skb && skb_is_tcp_pure_ack(skb)) { pr_debug("drop other suboptions"); opts->suboptions = 0; @@ -671,11 +674,7 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff * drop_other_suboptions = true; } - if (!mptcp_pm_should_add_signal(msk) || - !(mptcp_pm_add_addr_signal(msk, remaining, &opts->addr, &echo, &port))) - return false; - - len = mptcp_add_addr_len(opts->addr.family, echo, port); + len = mptcp_add_addr_len(opts, add_addr); if (remaining < len) return false; @@ -683,13 +682,15 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff * if (drop_other_suboptions) *size -= opt_size; opts->suboptions |= OPTION_MPTCP_ADD_ADDR; - if (!echo) { + if (!(add_addr & BIT(MPTCP_ADD_ADDR_ECHO)) && + (add_addr & BIT(MPTCP_ADD_ADDR_SIGNAL))) { opts->ahmac = add_addr_generate_hmac(msk->local_key, msk->remote_key, - &opts->addr); + &opts->local); } - pr_debug("addr_id=%d, ahmac=%llu, echo=%d, port=%d", - opts->addr.id, opts->ahmac, echo, ntohs(opts->addr.port)); + pr_debug("addr_signal:%x, echo=%d, local_addr_id=%d, ahmac=%llu, local_port=%d, remote_addr_id=%d, remote_port=%d", + add_addr, (opts->ahmac == 0), opts->local.id, opts->ahmac, + ntohs(opts->local.port), opts->remote.id, ntohs(opts->remote.port)); return true; } @@ -1229,15 +1230,19 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, mp_capable_done: if (OPTION_MPTCP_ADD_ADDR & opts->suboptions) { + struct mptcp_addr_info *addr = &opts->remote; u8 len = TCPOLEN_MPTCP_ADD_ADDR_BASE; u8 echo = MPTCP_ADDR_ECHO; + if (opts->ahmac) + addr = &opts->local; + #if IS_ENABLED(CONFIG_MPTCP_IPV6) - if (opts->addr.family == AF_INET6) + if (addr->family == AF_INET6) len = TCPOLEN_MPTCP_ADD_ADDR6_BASE; #endif - if (opts->addr.port) + if (addr->port) len += TCPOLEN_MPTCP_PORT_LEN; if (opts->ahmac) { @@ -1246,25 +1251,25 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, } *ptr++ = mptcp_option(MPTCPOPT_ADD_ADDR, - len, echo, opts->addr.id); - if (opts->addr.family == AF_INET) { - memcpy((u8 *)ptr, (u8 *)&opts->addr.addr.s_addr, 4); + len, echo, addr->id); + if (addr->family == AF_INET) { + memcpy((u8 *)ptr, (u8 *)&addr->addr.s_addr, 4); ptr += 1; } #if IS_ENABLED(CONFIG_MPTCP_IPV6) - else if (opts->addr.family == AF_INET6) { - memcpy((u8 *)ptr, opts->addr.addr6.s6_addr, 16); + else if (addr->family == AF_INET6) { + memcpy((u8 *)ptr, addr->addr6.s6_addr, 16); ptr += 4; } #endif - if (!opts->addr.port) { + if (!addr->port) { if (opts->ahmac) { put_unaligned_be64(opts->ahmac, ptr); ptr += 2; } } else { - u16 port = ntohs(opts->addr.port); + u16 port = ntohs(addr->port); if (opts->ahmac) { u8 *bptr = (u8 *)ptr; diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 6a91189..ad61b77 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -253,8 +253,9 @@ void mptcp_pm_mp_prio_received(struct sock *sk, u8 bkup) /* path manager helpers */ -bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, unsigned int remaining, - struct mptcp_addr_info *saddr, bool *echo, bool *port) +bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, struct sk_buff *skb, + unsigned int opt_size, unsigned int remaining, + struct mptcp_out_options *opts, u8 *add_addr) { int ret = false; @@ -264,13 +265,20 @@ bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, unsigned int remaining, if (!mptcp_pm_should_add_signal(msk)) goto out_unlock; - *echo = mptcp_pm_should_add_signal_echo(msk); - *port = mptcp_pm_should_add_signal_port(msk); + opts->local = msk->pm.local; + opts->remote = msk->pm.remote; + *add_addr = msk->pm.addr_signal; - if (remaining < mptcp_add_addr_len(msk->pm.local.family, *echo, *port)) + if (((msk->pm.addr_signal & BIT(MPTCP_ADD_ADDR_ECHO)) || + ((msk->pm.addr_signal & BIT(MPTCP_ADD_ADDR_SIGNAL)) && + (msk->pm.local.family == AF_INET6 || msk->pm.local.port))) && + skb && skb_is_tcp_pure_ack(skb)) { + remaining += opt_size; + } + + if (remaining < mptcp_add_addr_len(opts, *add_addr)) goto out_unlock; - *saddr = msk->pm.local; if ((msk->pm.addr_signal & BIT(MPTCP_ADD_ADDR_ECHO))) WRITE_ONCE(msk->pm.addr_signal, msk->pm.addr_signal & ~BIT(MPTCP_ADD_ADDR_ECHO)); else diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index a0b0ec0..f7be24a 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -737,16 +737,25 @@ static inline bool mptcp_pm_should_rm_signal(struct mptcp_sock *msk) return READ_ONCE(msk->pm.addr_signal) & BIT(MPTCP_RM_ADDR_SIGNAL); } -static inline unsigned int mptcp_add_addr_len(int family, bool echo, bool port) +static inline unsigned int mptcp_add_addr_len(struct mptcp_out_options *opts, + u8 add_addr) { - u8 len = TCPOLEN_MPTCP_ADD_ADDR_BASE; + struct mptcp_addr_info *addr = &opts->remote; + u8 len = 0; - if (family == AF_INET6) - len = TCPOLEN_MPTCP_ADD_ADDR6_BASE; - if (!echo) + if (!(add_addr & BIT(MPTCP_ADD_ADDR_ECHO)) && + (add_addr & BIT(MPTCP_ADD_ADDR_SIGNAL))) { + addr = &opts->local; len += MPTCPOPT_THMAC_LEN; + } + + if (addr->family == AF_INET6) + len += TCPOLEN_MPTCP_ADD_ADDR6_BASE; + else + len += TCPOLEN_MPTCP_ADD_ADDR_BASE; + /* account for 2 trailing 'nop' options */ - if (port) + if (addr->port) len += TCPOLEN_MPTCP_PORT_LEN + TCPOLEN_MPTCP_PORT_ALIGN; return len; @@ -760,8 +769,9 @@ static inline int mptcp_rm_addr_len(const struct mptcp_rm_list *rm_list) return TCPOLEN_MPTCP_RM_ADDR_BASE + roundup(rm_list->nr - 1, 4) + 1; } -bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, unsigned int remaining, - struct mptcp_addr_info *saddr, bool *echo, bool *port); +bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, struct sk_buff *skb, + unsigned int opt_size, unsigned int remaining, + struct mptcp_out_options *opts, u8 *add_addr); bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining, struct mptcp_rm_list *rm_list); int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc); From patchwork Wed Jul 7 17:01:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: YonglongLi X-Patchwork-Id: 12363063 Received: from chinatelecom.cn (prt-mail.chinatelecom.cn [42.123.76.228]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3A02C72 for ; Wed, 7 Jul 2021 17:02:13 +0000 (UTC) HMM_SOURCE_IP: 172.18.0.218:54022.267134115 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-36.111.140.9?logid-436ef2b3ccc547e0a5ea08a54c44f662 (unknown [172.18.0.218]) by chinatelecom.cn (HERMES) with SMTP id 5E11F2800E5; Thu, 8 Jul 2021 01:02:14 +0800 (CST) X-189-SAVE-TO-SEND: +liyonglong@chinatelecom.cn Received: from ([172.18.0.218]) by app0025 with ESMTP id e6cf80d89bce441292d264e3baf8f91f for mptcp@lists.linux.dev; Thu Jul 8 01:02:15 2021 X-Transaction-ID: e6cf80d89bce441292d264e3baf8f91f X-filter-score: X-Real-From: liyonglong@chinatelecom.cn X-Receive-IP: 172.18.0.218 X-MEDUSA-Status: 0 Sender: liyonglong@chinatelecom.cn From: Yonglong Li To: mptcp@lists.linux.dev Cc: mathew.j.martineau@linux.intel.com, geliangtang@gmail.com, Yonglong Li Subject: [PATCH v8 4/4] mptcp: remove MPTCP_ADD_ADDR_IPV6 and MPTCP_ADD_ADDR_PORT Date: Thu, 8 Jul 2021 01:01:41 +0800 Message-Id: <1625677301-139357-5-git-send-email-liyonglong@chinatelecom.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1625677301-139357-1-git-send-email-liyonglong@chinatelecom.cn> References: <1625677301-139357-1-git-send-email-liyonglong@chinatelecom.cn> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 MPTCP_ADD_ADDR_PORT and MPTCP_ADD_ADDR_PORT are not necessary, we can get these info from pm.local or pm.remote Signed-off-by: Yonglong Li --- net/mptcp/pm.c | 4 ---- net/mptcp/pm_netlink.c | 6 ++---- net/mptcp/protocol.h | 12 ------------ 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index ad61b77..29f777d 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -35,10 +35,6 @@ int mptcp_pm_announce_addr(struct mptcp_sock *msk, msk->pm.local = *addr; add_addr |= BIT(MPTCP_ADD_ADDR_SIGNAL); } - if (addr->family == AF_INET6) - add_addr |= BIT(MPTCP_ADD_ADDR_IPV6); - if (addr->port) - add_addr |= BIT(MPTCP_ADD_ADDR_PORT); WRITE_ONCE(msk->pm.addr_signal, add_addr); return 0; } diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 0f302d2..bfa9d6d 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -543,10 +543,8 @@ void mptcp_pm_nl_addr_send_ack(struct mptcp_sock *msk) bool slow; spin_unlock_bh(&msk->pm.lock); - pr_debug("send ack for %s%s%s", - mptcp_pm_should_add_signal(msk) ? "add_addr" : "rm_addr", - mptcp_pm_should_add_signal_ipv6(msk) ? " [ipv6]" : "", - mptcp_pm_should_add_signal_port(msk) ? " [port]" : ""); + pr_debug("send ack for %s", + mptcp_pm_should_add_signal(msk) ? "add_addr" : "rm_addr"); slow = lock_sock_fast(ssk); tcp_send_ack(ssk); diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index f7be24a..5c510f43 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -175,8 +175,6 @@ enum mptcp_pm_status { enum mptcp_addr_signal_status { MPTCP_ADD_ADDR_SIGNAL, MPTCP_ADD_ADDR_ECHO, - MPTCP_ADD_ADDR_IPV6, - MPTCP_ADD_ADDR_PORT, MPTCP_RM_ADDR_SIGNAL, }; @@ -722,16 +720,6 @@ static inline bool mptcp_pm_should_add_signal_echo(struct mptcp_sock *msk) return READ_ONCE(msk->pm.addr_signal) & BIT(MPTCP_ADD_ADDR_ECHO); } -static inline bool mptcp_pm_should_add_signal_ipv6(struct mptcp_sock *msk) -{ - return READ_ONCE(msk->pm.addr_signal) & BIT(MPTCP_ADD_ADDR_IPV6); -} - -static inline bool mptcp_pm_should_add_signal_port(struct mptcp_sock *msk) -{ - return READ_ONCE(msk->pm.addr_signal) & BIT(MPTCP_ADD_ADDR_PORT); -} - static inline bool mptcp_pm_should_rm_signal(struct mptcp_sock *msk) { return READ_ONCE(msk->pm.addr_signal) & BIT(MPTCP_RM_ADDR_SIGNAL);