Skip to content

Commit e4a58ef

Browse files
Guillaume Naultdavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6a86473 commit e4a58ef

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

include/net/pkt_cls.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,12 +502,16 @@ tcf_change_indev(struct net *net, struct nlattr *indev_tlv,
502502
struct net_device *dev;
503503

504504
if (nla_strlcpy(indev, indev_tlv, IFNAMSIZ) >= IFNAMSIZ) {
505-
NL_SET_ERR_MSG(extack, "Interface name too long");
505+
NL_SET_ERR_MSG_ATTR(extack, indev_tlv,
506+
"Interface name too long");
506507
return -EINVAL;
507508
}
508509
dev = __dev_get_by_name(net, indev);
509-
if (!dev)
510+
if (!dev) {
511+
NL_SET_ERR_MSG_ATTR(extack, indev_tlv,
512+
"Network device not found");
510513
return -ENODEV;
514+
}
511515
return dev->ifindex;
512516
}
513517

0 commit comments

Comments
 (0)