History

sunrpc: add a generic netlink family for cache upcalls

The auth.unix.ip and auth.unix.gid caches live in the sunrpc module, so they cannot use the nfsd generic netlink family. Create a new "sunrpc" generic netlink family with its own "exportd" multicast group to support cache upcall notifications for sunrpc-resident caches. Define a YAML spec (sunrpc_cache.yaml) with a cache-type enum (ip_map, unix_gid), a cache-notify multicast event, and the corresponding uapi header. Implement sunrpc_cache_notify() in cache.c, which checks for listeners on the exportd multicast group, builds and sends a SUNRPC_CMD_CACHE_NOTIFY message with the cache-type attribute. Register/unregister the sunrpc_nl_family in init_sunrpc() and cleanup_sunrpc().

Jeff Layton committed 7 months ago

Commit af81cb21 parent c13ecd48 files · +188 −1Browse files

Showing the changes to include/uapi (1 of 8 files). Show all

Unified · Split

include/uapi/linux/sunrpc_netlink.h+35−0
@@ -0,0 +1,35 @@
1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
2/* Do not edit directly, auto-generated from: */
3/* Documentation/netlink/specs/sunrpc_cache.yaml */
4/* YNL-GEN uapi header */
5/* To regenerate run: tools/net/ynl/ynl-regen.sh */
6
7#ifndef _UAPI_LINUX_SUNRPC_NETLINK_H
8#define _UAPI_LINUX_SUNRPC_NETLINK_H
9
10#define SUNRPC_FAMILY_NAME "sunrpc"
11#define SUNRPC_FAMILY_VERSION 1
12
13enum sunrpc_cache_type {
14 SUNRPC_CACHE_TYPE_IP_MAP = 1,
15 SUNRPC_CACHE_TYPE_UNIX_GID = 2,
16};
17
18enum {
19 SUNRPC_A_CACHE_NOTIFY_CACHE_TYPE = 1,
20
21 __SUNRPC_A_CACHE_NOTIFY_MAX,
22 SUNRPC_A_CACHE_NOTIFY_MAX = (__SUNRPC_A_CACHE_NOTIFY_MAX - 1)
23};
24
25enum {
26 SUNRPC_CMD_CACHE_NOTIFY = 1,
27
28 __SUNRPC_CMD_MAX,
29 SUNRPC_CMD_MAX = (__SUNRPC_CMD_MAX - 1)
30};
31
32#define SUNRPC_MCGRP_NONE "none"
33#define SUNRPC_MCGRP_EXPORTD "exportd"
34
35#endif /* _UAPI_LINUX_SUNRPC_NETLINK_H */