diff options
author | Johannes Berg <johannes.berg@intel.com> | 2017-04-12 14:34:06 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-04-13 13:58:21 -0400 |
commit | ba0dc5f6e0ba5a5d2f575bcdb35e5d1960cf7c04 (patch) | |
tree | 67f74587529492b36ee1566352d961f245efa45c /include/linux/netlink.h | |
parent | 7ab606d1609dd6dfeae9c8ad0a8a4e051d831e46 (diff) | |
download | lwn-ba0dc5f6e0ba5a5d2f575bcdb35e5d1960cf7c04.tar.gz lwn-ba0dc5f6e0ba5a5d2f575bcdb35e5d1960cf7c04.zip |
netlink: allow sending extended ACK with cookie on success
Now that we have extended error reporting and a new message format for
netlink ACK messages, also extend this to be able to return arbitrary
cookie data on success.
This will allow, for example, nl80211 to not send an extra message for
cookies identifying newly created objects, but return those directly
in the ACK message.
The cookie data size is currently limited to 20 bytes (since Jamal
talked about using SHA1 for identifiers.)
Thanks to Jamal Hadi Salim for bringing up this idea during the
discussions.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/netlink.h')
-rw-r--r-- | include/linux/netlink.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 60e7137f840d..8d2a8924705c 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h @@ -62,15 +62,22 @@ netlink_kernel_create(struct net *net, int unit, struct netlink_kernel_cfg *cfg) return __netlink_kernel_create(net, unit, THIS_MODULE, cfg); } +/* this can be increased when necessary - don't expose to userland */ +#define NETLINK_MAX_COOKIE_LEN 20 + /** * struct netlink_ext_ack - netlink extended ACK report struct * @_msg: message string to report - don't access directly, use * %NL_SET_ERR_MSG * @bad_attr: attribute with error + * @cookie: cookie data to return to userspace (for success) + * @cookie_len: actual cookie data length */ struct netlink_ext_ack { const char *_msg; const struct nlattr *bad_attr; + u8 cookie[NETLINK_MAX_COOKIE_LEN]; + u8 cookie_len; }; /* Always use this macro, this allows later putting the |