[PATCH mptcp-next] Squash to "mptcp: pm: add id parameter for get_addr"

Geliang Tang posted 1 patch 3 days, 14 hours ago
Failed in applying to current master (apply log)
net/mptcp/pm_netlink.c   | 4 +++-
net/mptcp/pm_userspace.c | 2 ++
2 files changed, 5 insertions(+), 1 deletion(-)
[PATCH mptcp-next] Squash to "mptcp: pm: add id parameter for get_addr"
Posted by Geliang Tang 3 days, 14 hours ago
From: Geliang Tang <tanggeliang@kylinos.cn>

No need to drop 'attr = info->attrs[MPTCP_PM_ENDPOINT_ADDR];' in
mptcp_userspace_pm_get_addr() too, add it back.

Alse update mptcp_pm_nl_get_addr() to keep the original two-line
assignment of 'attr'.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 net/mptcp/pm_netlink.c   | 4 +++-
 net/mptcp/pm_userspace.c | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index f7da750ab94f..b3d32f43a5a1 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -1775,13 +1775,15 @@ int mptcp_nl_fill_addr(struct sk_buff *skb,
 
 int mptcp_pm_nl_get_addr(u8 id, struct genl_info *info)
 {
-	struct nlattr *attr = info->attrs[MPTCP_PM_ENDPOINT_ADDR];
 	struct pm_nl_pernet *pernet = genl_info_pm_nl(info);
 	struct mptcp_pm_addr_entry *entry;
 	struct sk_buff *msg;
+	struct nlattr *attr;
 	void *reply;
 	int ret;
 
+	attr = info->attrs[MPTCP_PM_ENDPOINT_ADDR];
+
 	msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
 	if (!msg)
 		return -ENOMEM;
diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
index 79e2d12e0888..e005d5302e1c 100644
--- a/net/mptcp/pm_userspace.c
+++ b/net/mptcp/pm_userspace.c
@@ -700,6 +700,8 @@ int mptcp_userspace_pm_get_addr(u8 id, struct genl_info *info)
 
 	sk = (struct sock *)msk;
 
+	attr = info->attrs[MPTCP_PM_ENDPOINT_ADDR];
+
 	msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
 	if (!msg) {
 		ret = -ENOMEM;
-- 
2.45.2
Re: [PATCH mptcp-next] Squash to "mptcp: pm: add id parameter for get_addr"
Posted by Matthieu Baerts 3 days, 6 hours ago
Hi Geliang,

On 18/01/2025 00:26, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> No need to drop 'attr = info->attrs[MPTCP_PM_ENDPOINT_ADDR];' in
> mptcp_userspace_pm_get_addr() too, add it back.
> 
> Alse update mptcp_pm_nl_get_addr() to keep the original two-line
> assignment of 'attr'.

I did a simple fix instead, see 648a0809e4cf ("Squash to "mptcp: pm: add
id parameter for get_addr"") and the final export branch. Tell me if
that's not OK.

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.
Re: [PATCH mptcp-next] Squash to "mptcp: pm: add id parameter for get_addr"
Posted by Geliang Tang 3 days, 3 hours ago
Hi Matt,

On Sat, 2025-01-18 at 08:50 +0100, Matthieu Baerts wrote:
> Hi Geliang,
> 
> On 18/01/2025 00:26, Geliang Tang wrote:
> > From: Geliang Tang <tanggeliang@kylinos.cn>
> > 
> > No need to drop 'attr = info->attrs[MPTCP_PM_ENDPOINT_ADDR];' in
> > mptcp_userspace_pm_get_addr() too, add it back.
> > 
> > Alse update mptcp_pm_nl_get_addr() to keep the original two-line
> > assignment of 'attr'.
> 
> I did a simple fix instead, see 648a0809e4cf ("Squash to "mptcp: pm:
> add
> id parameter for get_addr"") and the final export branch. Tell me if
> that's not OK.

It works.

But we just change

	struct nlattr *token = info->attrs[MPTCP_PM_ATTR_TOKEN];

to
	struct nlattr *token;

	token = info->attrs[MPTCP_PM_ATTR_TOKEN];

in patch 5 "mptcp: pm: userspace: use GENL_REQ_ATTR_CHECK".

We change it back again in this patch 11.

So I prefer to use the two-line assignment of 'attr'. But up to you.

Thanks,
-Geliang

> 
> Cheers,
> Matt
Re: [PATCH mptcp-next] Squash to "mptcp: pm: add id parameter for get_addr"
Posted by Geliang Tang 3 days, 3 hours ago
Hi Matt,

On Sat, 2025-01-18 at 08:50 +0100, Matthieu Baerts wrote:
> Hi Geliang,
> 
> On 18/01/2025 00:26, Geliang Tang wrote:
> > From: Geliang Tang <tanggeliang@kylinos.cn>
> > 
> > No need to drop 'attr = info->attrs[MPTCP_PM_ENDPOINT_ADDR];' in
> > mptcp_userspace_pm_get_addr() too, add it back.
> > 
> > Alse update mptcp_pm_nl_get_addr() to keep the original two-line
> > assignment of 'attr'.
> 
> I did a simple fix instead, see 648a0809e4cf ("Squash to "mptcp: pm:
> add
> id parameter for get_addr"") and the final export branch. Tell me if
> that's not OK.

It works.

But we just change

	struct nlattr *token = info->attrs[MPTCP_PM_ATTR_TOKEN];

to
	struct nlattr *token;

	token = info->attrs[MPTCP_PM_ATTR_TOKEN];

in patch 5 "mptcp: pm: userspace: use GENL_REQ_ATTR_CHECK".

We change it back again in this patch 11.

So I prefer to use the two-line assignment of 'attr'. But up to you.

Thanks,
-Geliang

> 
> Cheers,
> Matt
Re: [PATCH mptcp-next] Squash to "mptcp: pm: add id parameter for get_addr"
Posted by Matthieu Baerts 1 day, 5 hours ago
Hi Geliang,

On 18/01/2025 11:54, Geliang Tang wrote:
> Hi Matt,
> 
> On Sat, 2025-01-18 at 08:50 +0100, Matthieu Baerts wrote:
>> Hi Geliang,
>>
>> On 18/01/2025 00:26, Geliang Tang wrote:
>>> From: Geliang Tang <tanggeliang@kylinos.cn>
>>>
>>> No need to drop 'attr = info->attrs[MPTCP_PM_ENDPOINT_ADDR];' in
>>> mptcp_userspace_pm_get_addr() too, add it back.
>>>
>>> Alse update mptcp_pm_nl_get_addr() to keep the original two-line
>>> assignment of 'attr'.
>>
>> I did a simple fix instead, see 648a0809e4cf ("Squash to "mptcp: pm:
>> add
>> id parameter for get_addr"") and the final export branch. Tell me if
>> that's not OK.
> 
> It works.
> 
> But we just change
> 
> 	struct nlattr *token = info->attrs[MPTCP_PM_ATTR_TOKEN];
> 
> to
> 	struct nlattr *token;
> 
> 	token = info->attrs[MPTCP_PM_ATTR_TOKEN];
> 
> in patch 5 "mptcp: pm: userspace: use GENL_REQ_ATTR_CHECK".
> 
> We change it back again in this patch 11.
> 
> So I prefer to use the two-line assignment of 'attr'. But up to you.

I see, it makes sense. But well, at the end, this code is going to be
moved elsewhere. Because the modifications have already been done
internally, I think it is fine to leave them like that, and avoid
dealing with new conflicts.

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.
Re: [PATCH mptcp-next] Squash to "mptcp: pm: add id parameter for get_addr"
Posted by Geliang Tang 1 day, 4 hours ago
On Mon, 2025-01-20 at 09:20 +0100, Matthieu Baerts wrote:
> Hi Geliang,
> 
> On 18/01/2025 11:54, Geliang Tang wrote:
> > Hi Matt,
> > 
> > On Sat, 2025-01-18 at 08:50 +0100, Matthieu Baerts wrote:
> > > Hi Geliang,
> > > 
> > > On 18/01/2025 00:26, Geliang Tang wrote:
> > > > From: Geliang Tang <tanggeliang@kylinos.cn>
> > > > 
> > > > No need to drop 'attr = info->attrs[MPTCP_PM_ENDPOINT_ADDR];'
> > > > in
> > > > mptcp_userspace_pm_get_addr() too, add it back.
> > > > 
> > > > Alse update mptcp_pm_nl_get_addr() to keep the original two-
> > > > line
> > > > assignment of 'attr'.
> > > 
> > > I did a simple fix instead, see 648a0809e4cf ("Squash to "mptcp:
> > > pm:
> > > add
> > > id parameter for get_addr"") and the final export branch. Tell me
> > > if
> > > that's not OK.
> > 
> > It works.
> > 
> > But we just change
> > 
> > 	struct nlattr *token = info->attrs[MPTCP_PM_ATTR_TOKEN];
> > 
> > to
> > 	struct nlattr *token;
> > 
> > 	token = info->attrs[MPTCP_PM_ATTR_TOKEN];
> > 
> > in patch 5 "mptcp: pm: userspace: use GENL_REQ_ATTR_CHECK".
> > 
> > We change it back again in this patch 11.
> > 
> > So I prefer to use the two-line assignment of 'attr'. But up to
> > you.
> 
> I see, it makes sense. But well, at the end, this code is going to be
> moved elsewhere. Because the modifications have already been done
> internally, I think it is fine to leave them like that, and avoid
> dealing with new conflicts.

Indeed, I agree.

Thanks,
-Geliang

> 
> Cheers,
> Matt