All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
To: mptcp@lists.linux.dev
Cc: Geliang Tang <geliang@kernel.org>,
	 "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
Subject: [PATCH mptcp-next v2 10/14] mptcp: pm: export mptcp_remote_address
Date: Fri, 28 Feb 2025 14:31:30 +0100	[thread overview]
Message-ID: <20250228-mptcp-pm-reorg-code-v2-10-fa8b2542b7a5@kernel.org> (raw)
In-Reply-To: <20250228-mptcp-pm-reorg-code-v2-0-fa8b2542b7a5@kernel.org>

In a following commit, the 'remote_address' helper will need to be used
from different files.

It is then exported, and prefixed with 'mptcp_', similar to
'mptcp_local_address'.

Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 net/mptcp/pm_netlink.c | 14 +++++++-------
 net/mptcp/protocol.h   |  5 ++++-
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index 37986208b9c0aac48d9a7b29fb37e11e947f0d66..27b8daf3bc3ff550b61fc9fdbd6f728804ea43bf 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -94,8 +94,8 @@ void mptcp_local_address(const struct sock_common *skc, struct mptcp_addr_info *
 #endif
 }
 
-static void remote_address(const struct sock_common *skc,
-			   struct mptcp_addr_info *addr)
+void mptcp_remote_address(const struct sock_common *skc,
+			  struct mptcp_addr_info *addr)
 {
 	addr->family = skc->skc_family;
 	addr->port = skc->skc_dport;
@@ -138,7 +138,7 @@ static bool lookup_subflow_by_daddr(const struct list_head *list,
 		      (TCPF_ESTABLISHED | TCPF_SYN_SENT | TCPF_SYN_RECV)))
 			continue;
 
-		remote_address((struct sock_common *)ssk, &cur);
+		mptcp_remote_address((struct sock_common *)ssk, &cur);
 		if (mptcp_addresses_equal(&cur, daddr, daddr->port))
 			return true;
 	}
@@ -428,7 +428,7 @@ static unsigned int fill_remote_addresses_vec(struct mptcp_sock *msk,
 	int i = 0;
 
 	subflows_max = mptcp_pm_get_subflows_max(msk);
-	remote_address((struct sock_common *)sk, &remote);
+	mptcp_remote_address((struct sock_common *)sk, &remote);
 
 	/* Non-fullmesh endpoint, fill in the single entry
 	 * corresponding to the primary MPC subflow remote address
@@ -455,7 +455,7 @@ static unsigned int fill_remote_addresses_vec(struct mptcp_sock *msk,
 
 		mptcp_for_each_subflow(msk, subflow) {
 			ssk = mptcp_subflow_tcp_sock(subflow);
-			remote_address((struct sock_common *)ssk, &addrs[i]);
+			mptcp_remote_address((struct sock_common *)ssk, &addrs[i]);
 			addrs[i].id = READ_ONCE(subflow->remote_id);
 			if (deny_id0 && !addrs[i].id)
 				continue;
@@ -777,7 +777,7 @@ bool mptcp_pm_is_init_remote_addr(struct mptcp_sock *msk,
 {
 	struct mptcp_addr_info mpc_remote;
 
-	remote_address((struct sock_common *)msk, &mpc_remote);
+	mptcp_remote_address((struct sock_common *)msk, &mpc_remote);
 	return mptcp_addresses_equal(&mpc_remote, remote, remote->port);
 }
 
@@ -826,7 +826,7 @@ int mptcp_pm_mp_prio_send_ack(struct mptcp_sock *msk,
 			continue;
 
 		if (rem && rem->family != AF_UNSPEC) {
-			remote_address((struct sock_common *)ssk, &remote);
+			mptcp_remote_address((struct sock_common *)ssk, &remote);
 			if (!mptcp_addresses_equal(&remote, rem, rem->port))
 				continue;
 		}
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 83ac7ac08e7723d8aea62f9d2f03f2d01ebf01e1..bd1782a569fe39f3c21c520feb8174472151e0de 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -729,7 +729,10 @@ void mptcp_set_state(struct sock *sk, int state);
 
 bool mptcp_addresses_equal(const struct mptcp_addr_info *a,
 			   const struct mptcp_addr_info *b, bool use_port);
-void mptcp_local_address(const struct sock_common *skc, struct mptcp_addr_info *addr);
+void mptcp_local_address(const struct sock_common *skc,
+			 struct mptcp_addr_info *addr);
+void mptcp_remote_address(const struct sock_common *skc,
+			  struct mptcp_addr_info *addr);
 
 /* called with sk socket lock held */
 int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_pm_local *local,

-- 
2.47.1


  parent reply	other threads:[~2025-02-28 13:31 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-28 13:31 [PATCH mptcp-next v2 00/14] mptcp: pm: code reorganisation Matthieu Baerts (NGI0)
2025-02-28 13:31 ` [PATCH mptcp-next v2 01/14] mptcp: pm: remove '_nl' from mptcp_pm_nl_addr_send_ack Matthieu Baerts (NGI0)
2025-02-28 13:31 ` [PATCH mptcp-next v2 02/14] mptcp: pm: remove '_nl' from mptcp_pm_nl_mp_prio_send_ack Matthieu Baerts (NGI0)
2025-02-28 13:31 ` [PATCH mptcp-next v2 03/14] mptcp: pm: remove '_nl' from mptcp_pm_nl_work Matthieu Baerts (NGI0)
2025-02-28 13:31 ` [PATCH mptcp-next v2 04/14] mptcp: pm: remove '_nl' from mptcp_pm_nl_rm_addr_received Matthieu Baerts (NGI0)
2025-02-28 13:31 ` [PATCH mptcp-next v2 05/14] mptcp: pm: remove '_nl' from mptcp_pm_nl_subflow_chk_stale() Matthieu Baerts (NGI0)
2025-02-28 13:31 ` [PATCH mptcp-next v2 06/14] mptcp: pm: remove '_nl' from mptcp_pm_nl_is_init_remote_addr Matthieu Baerts (NGI0)
2025-02-28 13:31 ` [PATCH mptcp-next v2 07/14] mptcp: pm: kernel: add '_pm' to mptcp_nl_set_flags Matthieu Baerts (NGI0)
2025-02-28 13:31 ` [PATCH mptcp-next v2 08/14] mptcp: pm: avoid calling PM specific code from core Matthieu Baerts (NGI0)
2025-02-28 13:31 ` [PATCH mptcp-next v2 09/14] mptcp: pm: worker: split in-kernel and common tasks Matthieu Baerts (NGI0)
2025-02-28 13:31 ` Matthieu Baerts (NGI0) [this message]
2025-02-28 13:31 ` [PATCH mptcp-next v2 11/14] mptcp: pm: move generic helper at the top Matthieu Baerts (NGI0)
2025-02-28 13:31 ` [PATCH mptcp-next v2 12/14] mptcp: pm: move generic PM helpers to pm.c Matthieu Baerts (NGI0)
2025-02-28 13:31 ` [PATCH mptcp-next v2 13/14] mptcp: pm: split in-kernel PM specific code Matthieu Baerts (NGI0)
2025-03-03 10:51   ` Matthieu Baerts
2025-02-28 13:31 ` [PATCH mptcp-next v2 14/14] mptcp: pm: move Netlink PM helpers to pm_netlink.c Matthieu Baerts (NGI0)
2025-02-28 14:44 ` [PATCH mptcp-next v2 00/14] mptcp: pm: code reorganisation MPTCP CI
2025-03-01  0:19 ` Geliang Tang
2025-03-01  0:20 ` Geliang Tang
2025-03-01  0:21 ` Geliang Tang
2025-03-01 11:10   ` Matthieu Baerts
2025-03-03 10:55     ` Geliang Tang
2025-03-03 11:07       ` Matthieu Baerts
2025-03-03 14:14         ` Matthieu Baerts

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250228-mptcp-pm-reorg-code-v2-10-fa8b2542b7a5@kernel.org \
    --to=matttbe@kernel.org \
    --cc=geliang@kernel.org \
    --cc=mptcp@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.