Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'ethtool-extack'

Jakub Kicinski says:

====================
net: support extack in dump and simplify ethtool uAPI

Ethtool currently requires header nest to be always present even if
it doesn't have to carry any attr for a given request. This inflicts
unnecessary pain on the users.

What makes it worse is that extack was not working in dump's ->start()
callback. Address both of those issues.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+7
+1
include/linux/netlink.h
··· 311 311 int (*start)(struct netlink_callback *); 312 312 int (*dump)(struct sk_buff *skb, struct netlink_callback *); 313 313 int (*done)(struct netlink_callback *); 314 + struct netlink_ext_ack *extack; 314 315 void *data; 315 316 struct module *module; 316 317 u32 min_dump_alloc;
+2
net/ethtool/netlink.c
··· 96 96 int ret; 97 97 98 98 if (!header) { 99 + if (!require_dev) 100 + return 0; 99 101 NL_SET_ERR_MSG(extack, "request header missing"); 100 102 return -EINVAL; 101 103 }
+2
net/netlink/af_netlink.c
··· 2360 2360 cb->strict_check = !!(nlk2->flags & NETLINK_F_STRICT_CHK); 2361 2361 2362 2362 if (control->start) { 2363 + cb->extack = control->extack; 2363 2364 ret = control->start(cb); 2365 + cb->extack = NULL; 2364 2366 if (ret) 2365 2367 goto error_put; 2366 2368 }
+2
net/netlink/genetlink.c
··· 912 912 .start = genl_start, 913 913 .dump = genl_lock_dumpit, 914 914 .done = genl_lock_done, 915 + .extack = extack, 915 916 }; 916 917 917 918 genl_unlock(); ··· 925 924 .start = genl_start, 926 925 .dump = ops->dumpit, 927 926 .done = genl_parallel_done, 927 + .extack = extack, 928 928 }; 929 929 930 930 err = __netlink_dump_start(net->genl_sock, skb, nlh, &c);