aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/netlink.c27
-rw-r--r--net/tipc/netlink_compat.c25
2 files changed, 27 insertions, 25 deletions
diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c
index 3200059d14b2..26ca8dd64ded 100644
--- a/net/tipc/netlink.c
+++ b/net/tipc/netlink.c
@@ -135,15 +135,6 @@ const struct nla_policy tipc_nl_udp_policy[TIPC_NLA_UDP_MAX + 1] = {
135/* Users of the legacy API (tipc-config) can't handle that we add operations, 135/* Users of the legacy API (tipc-config) can't handle that we add operations,
136 * so we have a separate genl handling for the new API. 136 * so we have a separate genl handling for the new API.
137 */ 137 */
138struct genl_family tipc_genl_family = {
139 .id = GENL_ID_GENERATE,
140 .name = TIPC_GENL_V2_NAME,
141 .version = TIPC_GENL_V2_VERSION,
142 .hdrsize = 0,
143 .maxattr = TIPC_NLA_MAX,
144 .netnsok = true,
145};
146
147static const struct genl_ops tipc_genl_v2_ops[] = { 138static const struct genl_ops tipc_genl_v2_ops[] = {
148 { 139 {
149 .cmd = TIPC_NL_BEARER_DISABLE, 140 .cmd = TIPC_NL_BEARER_DISABLE,
@@ -258,23 +249,33 @@ static const struct genl_ops tipc_genl_v2_ops[] = {
258#endif 249#endif
259}; 250};
260 251
252struct genl_family tipc_genl_family __ro_after_init = {
253 .name = TIPC_GENL_V2_NAME,
254 .version = TIPC_GENL_V2_VERSION,
255 .hdrsize = 0,
256 .maxattr = TIPC_NLA_MAX,
257 .netnsok = true,
258 .module = THIS_MODULE,
259 .ops = tipc_genl_v2_ops,
260 .n_ops = ARRAY_SIZE(tipc_genl_v2_ops),
261};
262
261int tipc_nlmsg_parse(const struct nlmsghdr *nlh, struct nlattr ***attr) 263int tipc_nlmsg_parse(const struct nlmsghdr *nlh, struct nlattr ***attr)
262{ 264{
263 u32 maxattr = tipc_genl_family.maxattr; 265 u32 maxattr = tipc_genl_family.maxattr;
264 266
265 *attr = tipc_genl_family.attrbuf; 267 *attr = genl_family_attrbuf(&tipc_genl_family);
266 if (!*attr) 268 if (!*attr)
267 return -EOPNOTSUPP; 269 return -EOPNOTSUPP;
268 270
269 return nlmsg_parse(nlh, GENL_HDRLEN, *attr, maxattr, tipc_nl_policy); 271 return nlmsg_parse(nlh, GENL_HDRLEN, *attr, maxattr, tipc_nl_policy);
270} 272}
271 273
272int tipc_netlink_start(void) 274int __init tipc_netlink_start(void)
273{ 275{
274 int res; 276 int res;
275 277
276 res = genl_register_family_with_ops(&tipc_genl_family, 278 res = genl_register_family(&tipc_genl_family);
277 tipc_genl_v2_ops);
278 if (res) { 279 if (res) {
279 pr_err("Failed to register netlink interface\n"); 280 pr_err("Failed to register netlink interface\n");
280 return res; 281 return res;
diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
index 1fd464764765..e1ae8a8a2b8e 100644
--- a/net/tipc/netlink_compat.c
+++ b/net/tipc/netlink_compat.c
@@ -1215,15 +1215,6 @@ send:
1215 return err; 1215 return err;
1216} 1216}
1217 1217
1218static struct genl_family tipc_genl_compat_family = {
1219 .id = GENL_ID_GENERATE,
1220 .name = TIPC_GENL_NAME,
1221 .version = TIPC_GENL_VERSION,
1222 .hdrsize = TIPC_GENL_HDRLEN,
1223 .maxattr = 0,
1224 .netnsok = true,
1225};
1226
1227static struct genl_ops tipc_genl_compat_ops[] = { 1218static struct genl_ops tipc_genl_compat_ops[] = {
1228 { 1219 {
1229 .cmd = TIPC_GENL_CMD, 1220 .cmd = TIPC_GENL_CMD,
@@ -1231,12 +1222,22 @@ static struct genl_ops tipc_genl_compat_ops[] = {
1231 }, 1222 },
1232}; 1223};
1233 1224
1234int tipc_netlink_compat_start(void) 1225static struct genl_family tipc_genl_compat_family __ro_after_init = {
1226 .name = TIPC_GENL_NAME,
1227 .version = TIPC_GENL_VERSION,
1228 .hdrsize = TIPC_GENL_HDRLEN,
1229 .maxattr = 0,
1230 .netnsok = true,
1231 .module = THIS_MODULE,
1232 .ops = tipc_genl_compat_ops,
1233 .n_ops = ARRAY_SIZE(tipc_genl_compat_ops),
1234};
1235
1236int __init tipc_netlink_compat_start(void)
1235{ 1237{
1236 int res; 1238 int res;
1237 1239
1238 res = genl_register_family_with_ops(&tipc_genl_compat_family, 1240 res = genl_register_family(&tipc_genl_compat_family);
1239 tipc_genl_compat_ops);
1240 if (res) { 1241 if (res) {
1241 pr_err("Failed to register legacy compat interface\n"); 1242 pr_err("Failed to register legacy compat interface\n");
1242 return res; 1243 return res;