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