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 	},
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