| 1 | |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 | #include <net/netlink.h>
|
| 8 | #include <net/genetlink.h>
|
| 9 |
|
| 10 | #include "netlink.h"
|
| 11 |
|
| 12 | #include <uapi/linux/lockd_netlink.h>
|
| 13 |
|
| 14 |
|
| 15 | static const struct nla_policy lockd_server_set_nl_policy[LOCKD_A_SERVER_UDP_PORT + 1] = {
|
| 16 | [LOCKD_A_SERVER_GRACETIME] = { .type = NLA_U32, },
|
| 17 | [LOCKD_A_SERVER_TCP_PORT] = { .type = NLA_U16, },
|
| 18 | [LOCKD_A_SERVER_UDP_PORT] = { .type = NLA_U16, },
|
| 19 | };
|
| 20 |
|
| 21 |
|
| 22 | static const struct genl_split_ops lockd_nl_ops[] = {
|
| 23 | {
|
| 24 | .cmd = LOCKD_CMD_SERVER_SET,
|
| 25 | .doit = lockd_nl_server_set_doit,
|
| 26 | .policy = lockd_server_set_nl_policy,
|
| 27 | .maxattr = LOCKD_A_SERVER_UDP_PORT,
|
| 28 | .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
|
| 29 | },
|
| 30 | {
|
| 31 | .cmd = LOCKD_CMD_SERVER_GET,
|
| 32 | .doit = lockd_nl_server_get_doit,
|
| 33 | .flags = GENL_CMD_CAP_DO,
|
| 34 | },
|
| 35 | };
|
| 36 |
|
| 37 | struct genl_family lockd_nl_family __ro_after_init = {
|
| 38 | .name = LOCKD_FAMILY_NAME,
|
| 39 | .version = LOCKD_FAMILY_VERSION,
|
| 40 | .netnsok = true,
|
| 41 | .parallel_ops = true,
|
| 42 | .module = THIS_MODULE,
|
| 43 | .split_ops = lockd_nl_ops,
|
| 44 | .n_split_ops = ARRAY_SIZE(lockd_nl_ops),
|
| 45 | };
|