From: Jakub Kicinski <kuba@kernel.org>
To: Florent Fourcot <florent.fourcot@wifirst.fr>
Cc: netdev@vger.kernel.org, cong.wang@bytedance.com,
edumazet@google.com, Jiri Pirko <jiri@mellanox.com>,
Brian Baboch <brian.baboch@wifirst.fr>
Subject: Re: [PATCH net v2] rtnetlink: enable alt_ifname for setlink/newlink
Date: Fri, 1 Apr 2022 10:43:42 -0700 [thread overview]
Message-ID: <20220401104342.5df7349a@kernel.org> (raw)
In-Reply-To: <20220401153939.19620-1-florent.fourcot@wifirst.fr>
On Fri, 1 Apr 2022 17:39:39 +0200 Florent Fourcot wrote:
> buffer called "ifname" given in function rtnl_dev_get
> is always valid when called by setlink/newlink,
> but contains only empty string when IFLA_IFNAME is not given. So
> IFLA_ALT_IFNAME is always ignored
>
> This patch fixes rtnl_dev_get function with a remove of ifname argument,
> and move ifname copy in do_setlink when required
>
> Changes in v2:
> * Remove ifname argument in rtnl_dev_get/do_setlink
> functions (simplify code)
>
> Fixes: 76c9ac0ee878 ("net: rtnetlink: add possibility to use alternative names as message handle")
> CC: Jiri Pirko <jiri@mellanox.com>
> Signed-off-by: Florent Fourcot <florent.fourcot@wifirst.fr>
> Signed-off-by: Brian Baboch <brian.baboch@wifirst.fr>
> @@ -3262,7 +3257,7 @@ static int rtnl_group_changelink(const struct sk_buff *skb,
>
> for_each_netdev_safe(net, dev, aux) {
> if (dev->group == group) {
> - err = do_setlink(skb, dev, ifm, extack, tb, NULL, 0);
> + err = do_setlink(skb, dev, ifm, extack, tb, 0);
This part depends on your other change, right? Do you care about this
getting into stable? Otherwise we can downgrade it from a fix to -next
and merge after your other patch. It never worked so we can go either
way on it being a fix. Actually leaning slightly towards it _not_ being
a fix.
> if (err < 0)
> return err;
> }
> @@ -3450,7 +3440,10 @@ static int __rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh,
> if (!ops->alloc && !ops->setup)
> return -EOPNOTSUPP;
>
> - if (!ifname[0]) {
> + if (tb[IFLA_IFNAME]) {
> + nla_strscpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ);
> + }
> + else {
Formatting slightly off here, should be
} else {
> snprintf(ifname, IFNAMSIZ, "%s%%d", ops->kind);
> name_assign_type = NET_NAME_ENUM;
> }
> @@ -3622,8 +3615,7 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr *nlh,
> if (ifm->ifi_index > 0)
> dev = __dev_get_by_index(tgt_net, ifm->ifi_index);
> else if (tb[IFLA_IFNAME] || tb[IFLA_ALT_IFNAME])
> - dev = rtnl_dev_get(tgt_net, tb[IFLA_IFNAME],
> - tb[IFLA_ALT_IFNAME], NULL);
> + dev = rtnl_dev_get(tgt_net, tb[IFLA_IFNAME], tb[IFLA_ALT_IFNAME]);
How about we pass tb and extract IFLA_IFNAME and IFLA_ALT_IFNAME inside
rtnl_dev_get()? All callers seem to pass the same args now.
> else
> goto out;
>
next prev parent reply other threads:[~2022-04-01 17:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-01 15:39 [PATCH net v2] rtnetlink: enable alt_ifname for setlink/newlink Florent Fourcot
2022-04-01 17:43 ` Jakub Kicinski [this message]
2022-04-01 21:02 ` Florent Fourcot
2022-04-01 22:09 ` Jakub Kicinski
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=20220401104342.5df7349a@kernel.org \
--to=kuba@kernel.org \
--cc=brian.baboch@wifirst.fr \
--cc=cong.wang@bytedance.com \
--cc=edumazet@google.com \
--cc=florent.fourcot@wifirst.fr \
--cc=jiri@mellanox.com \
--cc=netdev@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).