2022-02-01 20:10:20

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 5.16 136/200] mptcp: allow changing the "backup" bit by endpoint id

From: Davide Caratti <[email protected]>

[ Upstream commit 602837e8479d20d49559b4b97b79d34c0efe7ecb ]

a non-zero 'id' is sufficient to identify MPTCP endpoints: allow changing
the value of 'backup' bit by simply specifying the endpoint id.

Link: https://github.com/multipath-tcp/mptcp_net-next/issues/158
Signed-off-by: Davide Caratti <[email protected]>
Signed-off-by: Mat Martineau <[email protected]>
Signed-off-by: Jakub Kicinski <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
net/mptcp/pm_netlink.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index 65764c8171b37..d18b13e3e74c6 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -1711,22 +1711,28 @@ next:

static int mptcp_nl_cmd_set_flags(struct sk_buff *skb, struct genl_info *info)
{
+ struct mptcp_pm_addr_entry addr = { .addr = { .family = AF_UNSPEC }, }, *entry;
struct nlattr *attr = info->attrs[MPTCP_PM_ATTR_ADDR];
struct pm_nl_pernet *pernet = genl_info_pm_nl(info);
- struct mptcp_pm_addr_entry addr, *entry;
struct net *net = sock_net(skb->sk);
- u8 bkup = 0;
+ u8 bkup = 0, lookup_by_id = 0;
int ret;

- ret = mptcp_pm_parse_addr(attr, info, true, &addr);
+ ret = mptcp_pm_parse_addr(attr, info, false, &addr);
if (ret < 0)
return ret;

if (addr.flags & MPTCP_PM_ADDR_FLAG_BACKUP)
bkup = 1;
+ if (addr.addr.family == AF_UNSPEC) {
+ lookup_by_id = 1;
+ if (!addr.addr.id)
+ return -EOPNOTSUPP;
+ }

list_for_each_entry(entry, &pernet->local_addr_list, list) {
- if (addresses_equal(&entry->addr, &addr.addr, true)) {
+ if ((!lookup_by_id && addresses_equal(&entry->addr, &addr.addr, true)) ||
+ (lookup_by_id && entry->addr.id == addr.addr.id)) {
mptcp_nl_addr_backup(net, &entry->addr, bkup);

if (bkup)
--
2.34.1




2022-02-01 20:56:20

by Mat Martineau

[permalink] [raw]
Subject: Re: [PATCH 5.16 136/200] mptcp: allow changing the "backup" bit by endpoint id

On Mon, 31 Jan 2022, Greg Kroah-Hartman wrote:

> From: Davide Caratti <[email protected]>
>
> [ Upstream commit 602837e8479d20d49559b4b97b79d34c0efe7ecb ]
>

Please drop this from both the 5.15 and 5.16 queues. This patch adds a new
feature (doesn't appear to meet the stable rules). It is fairly self
contained and probably won't break anything, but it wasn't intended to be
backported.


Thanks,
Mat


> a non-zero 'id' is sufficient to identify MPTCP endpoints: allow changing
> the value of 'backup' bit by simply specifying the endpoint id.
>
> Link: https://github.com/multipath-tcp/mptcp_net-next/issues/158
> Signed-off-by: Davide Caratti <[email protected]>
> Signed-off-by: Mat Martineau <[email protected]>
> Signed-off-by: Jakub Kicinski <[email protected]>
> Signed-off-by: Sasha Levin <[email protected]>
> ---
> net/mptcp/pm_netlink.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
> index 65764c8171b37..d18b13e3e74c6 100644
> --- a/net/mptcp/pm_netlink.c
> +++ b/net/mptcp/pm_netlink.c
> @@ -1711,22 +1711,28 @@ next:
>
> static int mptcp_nl_cmd_set_flags(struct sk_buff *skb, struct genl_info *info)
> {
> + struct mptcp_pm_addr_entry addr = { .addr = { .family = AF_UNSPEC }, }, *entry;
> struct nlattr *attr = info->attrs[MPTCP_PM_ATTR_ADDR];
> struct pm_nl_pernet *pernet = genl_info_pm_nl(info);
> - struct mptcp_pm_addr_entry addr, *entry;
> struct net *net = sock_net(skb->sk);
> - u8 bkup = 0;
> + u8 bkup = 0, lookup_by_id = 0;
> int ret;
>
> - ret = mptcp_pm_parse_addr(attr, info, true, &addr);
> + ret = mptcp_pm_parse_addr(attr, info, false, &addr);
> if (ret < 0)
> return ret;
>
> if (addr.flags & MPTCP_PM_ADDR_FLAG_BACKUP)
> bkup = 1;
> + if (addr.addr.family == AF_UNSPEC) {
> + lookup_by_id = 1;
> + if (!addr.addr.id)
> + return -EOPNOTSUPP;
> + }
>
> list_for_each_entry(entry, &pernet->local_addr_list, list) {
> - if (addresses_equal(&entry->addr, &addr.addr, true)) {
> + if ((!lookup_by_id && addresses_equal(&entry->addr, &addr.addr, true)) ||
> + (lookup_by_id && entry->addr.id == addr.addr.id)) {
> mptcp_nl_addr_backup(net, &entry->addr, bkup);
>
> if (bkup)
> --
> 2.34.1
>
>
>
>

--
Mat Martineau
Intel