Skip to content

Commit

Permalink
net: rtnetlink: unify the code in __rtnl_newlink get dev with the rest
Browse files Browse the repository at this point in the history
__rtnl_newlink() code flow is a bit different around tb[IFLA_IFNAME]
processing comparing to the other places. Change that to be unified with
the rest.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jiri Pirko authored and David S. Miller committed Oct 1, 2019
1 parent 88f4fb0 commit 7af12cb
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions net/core/rtnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -3080,12 +3080,10 @@ static int __rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh,
ifm = nlmsg_data(nlh);
if (ifm->ifi_index > 0)
dev = __dev_get_by_index(net, ifm->ifi_index);
else {
if (ifname[0])
dev = __dev_get_by_name(net, ifname);
else
dev = NULL;
}
else if (tb[IFLA_IFNAME])
dev = __dev_get_by_name(net, ifname);
else
dev = NULL;

if (dev) {
master_dev = netdev_master_upper_dev_get(dev);
Expand Down

0 comments on commit 7af12cb

Please sign in to comment.