xref: /linux/net/mptcp/mptcp_pm_gen.c (revision ba199dc909a20fe62270ae4e93f263987bb9d119)
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/mptcp_pm.yaml */
4 /* YNL-GEN kernel source */
5 
6 #include <net/netlink.h>
7 #include <net/genetlink.h>
8 
9 #include "mptcp_pm_gen.h"
10 
11 #include <uapi/linux/mptcp_pm.h>
12 
13 /* Common nested types */
14 const struct nla_policy mptcp_pm_address_nl_policy[MPTCP_PM_ADDR_ATTR_IF_IDX + 1] = {
15 	[MPTCP_PM_ADDR_ATTR_FAMILY] = { .type = NLA_U16, },
16 	[MPTCP_PM_ADDR_ATTR_ID] = { .type = NLA_U8, },
17 	[MPTCP_PM_ADDR_ATTR_ADDR4] = { .type = NLA_U32, },
18 	[MPTCP_PM_ADDR_ATTR_ADDR6] = NLA_POLICY_EXACT_LEN(16),
19 	[MPTCP_PM_ADDR_ATTR_PORT] = { .type = NLA_U16, },
20 	[MPTCP_PM_ADDR_ATTR_FLAGS] = { .type = NLA_U32, },
21 	[MPTCP_PM_ADDR_ATTR_IF_IDX] = { .type = NLA_S32, },
22 };
23 
24 /* MPTCP_PM_CMD_ADD_ADDR - do */
25 const struct nla_policy mptcp_pm_add_addr_nl_policy[MPTCP_PM_ENDPOINT_ADDR + 1] = {
26 	[MPTCP_PM_ENDPOINT_ADDR] = NLA_POLICY_NESTED(mptcp_pm_address_nl_policy),
27 };
28 
29 /* MPTCP_PM_CMD_DEL_ADDR - do */
30 const struct nla_policy mptcp_pm_del_addr_nl_policy[MPTCP_PM_ENDPOINT_ADDR + 1] = {
31 	[MPTCP_PM_ENDPOINT_ADDR] = NLA_POLICY_NESTED(mptcp_pm_address_nl_policy),
32 };
33 
34 /* MPTCP_PM_CMD_GET_ADDR - do */
35 const struct nla_policy mptcp_pm_get_addr_nl_policy[MPTCP_PM_ATTR_TOKEN + 1] = {
36 	[MPTCP_PM_ATTR_ADDR] = NLA_POLICY_NESTED(mptcp_pm_address_nl_policy),
37 	[MPTCP_PM_ATTR_TOKEN] = { .type = NLA_U32, },
38 };
39 
40 /* MPTCP_PM_CMD_FLUSH_ADDRS - do */
41 const struct nla_policy mptcp_pm_flush_addrs_nl_policy[MPTCP_PM_ENDPOINT_ADDR + 1] = {
42 	[MPTCP_PM_ENDPOINT_ADDR] = NLA_POLICY_NESTED(mptcp_pm_address_nl_policy),
43 };
44 
45 /* MPTCP_PM_CMD_SET_LIMITS - do */
46 const struct nla_policy mptcp_pm_set_limits_nl_policy[MPTCP_PM_ATTR_SUBFLOWS + 1] = {
47 	[MPTCP_PM_ATTR_RCV_ADD_ADDRS] = { .type = NLA_U32, },
48 	[MPTCP_PM_ATTR_SUBFLOWS] = { .type = NLA_U32, },
49 };
50 
51 /* MPTCP_PM_CMD_GET_LIMITS - do */
52 const struct nla_policy mptcp_pm_get_limits_nl_policy[MPTCP_PM_ATTR_SUBFLOWS + 1] = {
53 	[MPTCP_PM_ATTR_RCV_ADD_ADDRS] = { .type = NLA_U32, },
54 	[MPTCP_PM_ATTR_SUBFLOWS] = { .type = NLA_U32, },
55 };
56 
57 /* MPTCP_PM_CMD_SET_FLAGS - do */
58 const struct nla_policy mptcp_pm_set_flags_nl_policy[MPTCP_PM_ATTR_ADDR_REMOTE + 1] = {
59 	[MPTCP_PM_ATTR_ADDR] = NLA_POLICY_NESTED(mptcp_pm_address_nl_policy),
60 	[MPTCP_PM_ATTR_TOKEN] = { .type = NLA_U32, },
61 	[MPTCP_PM_ATTR_ADDR_REMOTE] = NLA_POLICY_NESTED(mptcp_pm_address_nl_policy),
62 };
63 
64 /* MPTCP_PM_CMD_ANNOUNCE - do */
65 const struct nla_policy mptcp_pm_announce_nl_policy[MPTCP_PM_ATTR_TOKEN + 1] = {
66 	[MPTCP_PM_ATTR_ADDR] = NLA_POLICY_NESTED(mptcp_pm_address_nl_policy),
67 	[MPTCP_PM_ATTR_TOKEN] = { .type = NLA_U32, },
68 };
69 
70 /* MPTCP_PM_CMD_REMOVE - do */
71 const struct nla_policy mptcp_pm_remove_nl_policy[MPTCP_PM_ATTR_LOC_ID + 1] = {
72 	[MPTCP_PM_ATTR_TOKEN] = { .type = NLA_U32, },
73 	[MPTCP_PM_ATTR_LOC_ID] = { .type = NLA_U8, },
74 };
75 
76 /* MPTCP_PM_CMD_SUBFLOW_CREATE - do */
77 const struct nla_policy mptcp_pm_subflow_create_nl_policy[MPTCP_PM_ATTR_ADDR_REMOTE + 1] = {
78 	[MPTCP_PM_ATTR_ADDR] = NLA_POLICY_NESTED(mptcp_pm_address_nl_policy),
79 	[MPTCP_PM_ATTR_TOKEN] = { .type = NLA_U32, },
80 	[MPTCP_PM_ATTR_ADDR_REMOTE] = NLA_POLICY_NESTED(mptcp_pm_address_nl_policy),
81 };
82 
83 /* MPTCP_PM_CMD_SUBFLOW_DESTROY - do */
84 const struct nla_policy mptcp_pm_subflow_destroy_nl_policy[MPTCP_PM_ATTR_ADDR_REMOTE + 1] = {
85 	[MPTCP_PM_ATTR_ADDR] = NLA_POLICY_NESTED(mptcp_pm_address_nl_policy),
86 	[MPTCP_PM_ATTR_TOKEN] = { .type = NLA_U32, },
87 	[MPTCP_PM_ATTR_ADDR_REMOTE] = NLA_POLICY_NESTED(mptcp_pm_address_nl_policy),
88 };
89 
90 /* Ops table for mptcp_pm */
91 const struct genl_ops mptcp_pm_nl_ops[11] = {
92 	{
93 		.cmd		= MPTCP_PM_CMD_ADD_ADDR,
94 		.validate	= GENL_DONT_VALIDATE_STRICT,
95 		.doit		= mptcp_pm_nl_add_addr_doit,
96 		.policy		= mptcp_pm_add_addr_nl_policy,
97 		.maxattr	= MPTCP_PM_ENDPOINT_ADDR,
98 		.flags		= GENL_UNS_ADMIN_PERM,
99 	},
100 	{
101 		.cmd		= MPTCP_PM_CMD_DEL_ADDR,
102 		.validate	= GENL_DONT_VALIDATE_STRICT,
103 		.doit		= mptcp_pm_nl_del_addr_doit,
104 		.policy		= mptcp_pm_del_addr_nl_policy,
105 		.maxattr	= MPTCP_PM_ENDPOINT_ADDR,
106 		.flags		= GENL_UNS_ADMIN_PERM,
107 	},
108 	{
109 		.cmd		= MPTCP_PM_CMD_GET_ADDR,
110 		.validate	= GENL_DONT_VALIDATE_STRICT,
111 		.doit		= mptcp_pm_nl_get_addr_doit,
112 		.dumpit		= mptcp_pm_nl_get_addr_dumpit,
113 		.policy		= mptcp_pm_get_addr_nl_policy,
114 		.maxattr	= MPTCP_PM_ATTR_TOKEN,
115 		.flags		= GENL_UNS_ADMIN_PERM,
116 	},
117 	{
118 		.cmd		= MPTCP_PM_CMD_FLUSH_ADDRS,
119 		.validate	= GENL_DONT_VALIDATE_STRICT,
120 		.doit		= mptcp_pm_nl_flush_addrs_doit,
121 		.policy		= mptcp_pm_flush_addrs_nl_policy,
122 		.maxattr	= MPTCP_PM_ENDPOINT_ADDR,
123 		.flags		= GENL_UNS_ADMIN_PERM,
124 	},
125 	{
126 		.cmd		= MPTCP_PM_CMD_SET_LIMITS,
127 		.validate	= GENL_DONT_VALIDATE_STRICT,
128 		.doit		= mptcp_pm_nl_set_limits_doit,
129 		.policy		= mptcp_pm_set_limits_nl_policy,
130 		.maxattr	= MPTCP_PM_ATTR_SUBFLOWS,
131 		.flags		= GENL_UNS_ADMIN_PERM,
132 	},
133 	{
134 		.cmd		= MPTCP_PM_CMD_GET_LIMITS,
135 		.validate	= GENL_DONT_VALIDATE_STRICT,
136 		.doit		= mptcp_pm_nl_get_limits_doit,
137 		.policy		= mptcp_pm_get_limits_nl_policy,
138 		.maxattr	= MPTCP_PM_ATTR_SUBFLOWS,
139 	},
140 	{
141 		.cmd		= MPTCP_PM_CMD_SET_FLAGS,
142 		.validate	= GENL_DONT_VALIDATE_STRICT,
143 		.doit		= mptcp_pm_nl_set_flags_doit,
144 		.policy		= mptcp_pm_set_flags_nl_policy,
145 		.maxattr	= MPTCP_PM_ATTR_ADDR_REMOTE,
146 		.flags		= GENL_UNS_ADMIN_PERM,
147 	},
148 	{
149 		.cmd		= MPTCP_PM_CMD_ANNOUNCE,
150 		.validate	= GENL_DONT_VALIDATE_STRICT,
151 		.doit		= mptcp_pm_nl_announce_doit,
152 		.policy		= mptcp_pm_announce_nl_policy,
153 		.maxattr	= MPTCP_PM_ATTR_TOKEN,
154 		.flags		= GENL_UNS_ADMIN_PERM,
155 	},
156 	{
157 		.cmd		= MPTCP_PM_CMD_REMOVE,
158 		.validate	= GENL_DONT_VALIDATE_STRICT,
159 		.doit		= mptcp_pm_nl_remove_doit,
160 		.policy		= mptcp_pm_remove_nl_policy,
161 		.maxattr	= MPTCP_PM_ATTR_LOC_ID,
162 		.flags		= GENL_UNS_ADMIN_PERM,
163 	},
164 	{
165 		.cmd		= MPTCP_PM_CMD_SUBFLOW_CREATE,
166 		.validate	= GENL_DONT_VALIDATE_STRICT,
167 		.doit		= mptcp_pm_nl_subflow_create_doit,
168 		.policy		= mptcp_pm_subflow_create_nl_policy,
169 		.maxattr	= MPTCP_PM_ATTR_ADDR_REMOTE,
170 		.flags		= GENL_UNS_ADMIN_PERM,
171 	},
172 	{
173 		.cmd		= MPTCP_PM_CMD_SUBFLOW_DESTROY,
174 		.validate	= GENL_DONT_VALIDATE_STRICT,
175 		.doit		= mptcp_pm_nl_subflow_destroy_doit,
176 		.policy		= mptcp_pm_subflow_destroy_nl_policy,
177 		.maxattr	= MPTCP_PM_ATTR_ADDR_REMOTE,
178 		.flags		= GENL_UNS_ADMIN_PERM,
179 	},
180 };
181