From: Guillaume Nault Date: Mon, 23 Mar 2020 20:48:47 +0000 (+0100) Subject: net: sched: refine extack messages in tcf_change_indev X-Git-Tag: v5.7-rc1~146^2~63^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e4a58ef3ce4e7bd20c22390b13799c8f1c498780;p=thirdparty%2Fkernel%2Flinux.git 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: Guillaume Nault Signed-off-by: David S. Miller --- diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index 1db8b27d45153..41902e10d5034 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h @@ -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; }