Skip to content

Commit

Permalink
net: sched: refine extack messages in tcf_change_indev
Browse files Browse the repository at this point in the history
Add an error message when device wasn't found.
While there, also set the bad attribute's offset in extack.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Guillaume Nault authored and David S. Miller committed Mar 27, 2020
1 parent 6a86473 commit e4a58ef
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions include/net/pkt_cls.h
Original file line number Diff line number Diff line change
Expand Up @@ -502,12 +502,16 @@ tcf_change_indev(struct net *net, struct nlattr *indev_tlv,
struct net_device *dev;

if (nla_strlcpy(indev, indev_tlv, IFNAMSIZ) >= IFNAMSIZ) {
NL_SET_ERR_MSG(extack, "Interface name too long");
NL_SET_ERR_MSG_ATTR(extack, indev_tlv,
"Interface name too long");
return -EINVAL;
}
dev = __dev_get_by_name(net, indev);
if (!dev)
if (!dev) {
NL_SET_ERR_MSG_ATTR(extack, indev_tlv,
"Network device not found");
return -ENODEV;
}
return dev->ifindex;
}

Expand Down

0 comments on commit e4a58ef

Please sign in to comment.