Commit e4a58ef3 authored by Guillaume Nault's avatar Guillaume Nault Committed by David S. Miller

net: sched: refine extack messages in tcf_change_indev

Add an error message when device wasn't found.
While there, also set the bad attribute's offset in extack.
Signed-off-by: default avatarGuillaume Nault <gnault@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6a864730
...@@ -502,12 +502,16 @@ tcf_change_indev(struct net *net, struct nlattr *indev_tlv, ...@@ -502,12 +502,16 @@ tcf_change_indev(struct net *net, struct nlattr *indev_tlv,
struct net_device *dev; struct net_device *dev;
if (nla_strlcpy(indev, indev_tlv, IFNAMSIZ) >= IFNAMSIZ) { 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; return -EINVAL;
} }
dev = __dev_get_by_name(net, indev); 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 -ENODEV;
}
return dev->ifindex; return dev->ifindex;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment