diff options
author | David S. Miller <davem@davemloft.net> | 2023-06-12 11:32:45 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-06-12 11:32:45 +0100 |
commit | f2f069da4c40dcf136db731c9fece17c3bbf7cdc (patch) | |
tree | 4d86ba36fb3a24593be237c151aad15439d1bea8 | |
parent | 238131684f7b1bc2e0788583f22ed67bf3f5ca37 (diff) | |
parent | 500e1340d1d2695de3f15fc0b3781f593a77acc2 (diff) | |
download | linux-f2f069da4c40dcf136db731c9fece17c3bbf7cdc.tar.gz linux-f2f069da4c40dcf136db731c9fece17c3bbf7cdc.tar.bz2 linux-f2f069da4c40dcf136db731c9fece17c3bbf7cdc.zip |
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>
-rw-r--r-- | include/linux/netlink.h | 1 | ||||
-rw-r--r-- | net/ethtool/netlink.c | 2 | ||||
-rw-r--r-- | net/netlink/af_netlink.c | 2 | ||||
-rw-r--r-- | net/netlink/genetlink.c | 2 |
4 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 19c0791ed9d5..9eec3f4f5351 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h @@ -311,6 +311,7 @@ struct netlink_dump_control { int (*start)(struct netlink_callback *); int (*dump)(struct sk_buff *skb, struct netlink_callback *); int (*done)(struct netlink_callback *); + struct netlink_ext_ack *extack; void *data; struct module *module; u32 min_dump_alloc; diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c index 08120095cc68..5dd5e8222c45 100644 --- a/net/ethtool/netlink.c +++ b/net/ethtool/netlink.c @@ -96,6 +96,8 @@ int ethnl_parse_header_dev_get(struct ethnl_req_info *req_info, int ret; if (!header) { + if (!require_dev) + return 0; NL_SET_ERR_MSG(extack, "request header missing"); return -EINVAL; } diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 3a1e0fd5bf14..cbd9aa7ee24a 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -2360,7 +2360,9 @@ int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb, cb->strict_check = !!(nlk2->flags & NETLINK_F_STRICT_CHK); if (control->start) { + cb->extack = control->extack; ret = control->start(cb); + cb->extack = NULL; if (ret) goto error_put; } diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 04c4036bf406..a157247a1e45 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c @@ -912,6 +912,7 @@ static int genl_family_rcv_msg_dumpit(const struct genl_family *family, .start = genl_start, .dump = genl_lock_dumpit, .done = genl_lock_done, + .extack = extack, }; genl_unlock(); @@ -924,6 +925,7 @@ static int genl_family_rcv_msg_dumpit(const struct genl_family *family, .start = genl_start, .dump = ops->dumpit, .done = genl_parallel_done, + .extack = extack, }; err = __netlink_dump_start(net->genl_sock, skb, nlh, &c); |