1b97bf3fdSPer Liden /* 2b97bf3fdSPer Liden * net/tipc/netlink.c: TIPC configuration handling 3b97bf3fdSPer Liden * 40655f6a8SRichard Alpe * Copyright (c) 2005-2006, 2014, Ericsson AB 559f0c452SAllan Stephens * Copyright (c) 2005-2007, Wind River Systems 6b97bf3fdSPer Liden * All rights reserved. 7b97bf3fdSPer Liden * 8b97bf3fdSPer Liden * Redistribution and use in source and binary forms, with or without 9b97bf3fdSPer Liden * modification, are permitted provided that the following conditions are met: 10b97bf3fdSPer Liden * 119ea1fd3cSPer Liden * 1. Redistributions of source code must retain the above copyright 129ea1fd3cSPer Liden * notice, this list of conditions and the following disclaimer. 139ea1fd3cSPer Liden * 2. Redistributions in binary form must reproduce the above copyright 149ea1fd3cSPer Liden * notice, this list of conditions and the following disclaimer in the 159ea1fd3cSPer Liden * documentation and/or other materials provided with the distribution. 169ea1fd3cSPer Liden * 3. Neither the names of the copyright holders nor the names of its 179ea1fd3cSPer Liden * contributors may be used to endorse or promote products derived from 189ea1fd3cSPer Liden * this software without specific prior written permission. 199ea1fd3cSPer Liden * 209ea1fd3cSPer Liden * Alternatively, this software may be distributed under the terms of the 219ea1fd3cSPer Liden * GNU General Public License ("GPL") version 2 as published by the Free 229ea1fd3cSPer Liden * Software Foundation. 23b97bf3fdSPer Liden * 24b97bf3fdSPer Liden * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25b97bf3fdSPer Liden * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26b97bf3fdSPer Liden * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27b97bf3fdSPer Liden * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 28b97bf3fdSPer Liden * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29b97bf3fdSPer Liden * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30b97bf3fdSPer Liden * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31b97bf3fdSPer Liden * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32b97bf3fdSPer Liden * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33b97bf3fdSPer Liden * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34b97bf3fdSPer Liden * POSSIBILITY OF SUCH DAMAGE. 35b97bf3fdSPer Liden */ 36b97bf3fdSPer Liden 37b97bf3fdSPer Liden #include "core.h" 3834b78a12SRichard Alpe #include "socket.h" 391593123aSRichard Alpe #include "name_table.h" 400655f6a8SRichard Alpe #include "bearer.h" 417be57fc6SRichard Alpe #include "link.h" 423e4b6ab5SRichard Alpe #include "node.h" 43fd3cf2adSRichard Alpe #include "net.h" 44832629caSRichard Alpe #include "udp_media.h" 45b97bf3fdSPer Liden #include <net/genetlink.h> 46b97bf3fdSPer Liden 470655f6a8SRichard Alpe static const struct nla_policy tipc_nl_policy[TIPC_NLA_MAX + 1] = { 480655f6a8SRichard Alpe [TIPC_NLA_UNSPEC] = { .type = NLA_UNSPEC, }, 490655f6a8SRichard Alpe [TIPC_NLA_BEARER] = { .type = NLA_NESTED, }, 5034b78a12SRichard Alpe [TIPC_NLA_SOCK] = { .type = NLA_NESTED, }, 517be57fc6SRichard Alpe [TIPC_NLA_PUBL] = { .type = NLA_NESTED, }, 527be57fc6SRichard Alpe [TIPC_NLA_LINK] = { .type = NLA_NESTED, }, 5346f15c67SRichard Alpe [TIPC_NLA_MEDIA] = { .type = NLA_NESTED, }, 54fd3cf2adSRichard Alpe [TIPC_NLA_NODE] = { .type = NLA_NESTED, }, 551593123aSRichard Alpe [TIPC_NLA_NET] = { .type = NLA_NESTED, }, 567b3f5229SParthasarathy Bhuvaragan [TIPC_NLA_NAME_TABLE] = { .type = NLA_NESTED, }, 577b3f5229SParthasarathy Bhuvaragan [TIPC_NLA_MON] = { .type = NLA_NESTED, }, 580655f6a8SRichard Alpe }; 590655f6a8SRichard Alpe 6049cc66eaSRichard Alpe const struct nla_policy 6149cc66eaSRichard Alpe tipc_nl_name_table_policy[TIPC_NLA_NAME_TABLE_MAX + 1] = { 6249cc66eaSRichard Alpe [TIPC_NLA_NAME_TABLE_UNSPEC] = { .type = NLA_UNSPEC }, 6349cc66eaSRichard Alpe [TIPC_NLA_NAME_TABLE_PUBL] = { .type = NLA_NESTED } 6449cc66eaSRichard Alpe }; 6549cc66eaSRichard Alpe 667b3f5229SParthasarathy Bhuvaragan const struct nla_policy tipc_nl_monitor_policy[TIPC_NLA_MON_MAX + 1] = { 677b3f5229SParthasarathy Bhuvaragan [TIPC_NLA_MON_UNSPEC] = { .type = NLA_UNSPEC }, 68cf6f7e1dSParthasarathy Bhuvaragan [TIPC_NLA_MON_REF] = { .type = NLA_U32 }, 697b3f5229SParthasarathy Bhuvaragan [TIPC_NLA_MON_ACTIVATION_THRESHOLD] = { .type = NLA_U32 }, 707b3f5229SParthasarathy Bhuvaragan }; 717b3f5229SParthasarathy Bhuvaragan 7249cc66eaSRichard Alpe const struct nla_policy tipc_nl_sock_policy[TIPC_NLA_SOCK_MAX + 1] = { 7349cc66eaSRichard Alpe [TIPC_NLA_SOCK_UNSPEC] = { .type = NLA_UNSPEC }, 7449cc66eaSRichard Alpe [TIPC_NLA_SOCK_ADDR] = { .type = NLA_U32 }, 7549cc66eaSRichard Alpe [TIPC_NLA_SOCK_REF] = { .type = NLA_U32 }, 7649cc66eaSRichard Alpe [TIPC_NLA_SOCK_CON] = { .type = NLA_NESTED }, 7749cc66eaSRichard Alpe [TIPC_NLA_SOCK_HAS_PUBL] = { .type = NLA_FLAG } 7849cc66eaSRichard Alpe }; 7949cc66eaSRichard Alpe 8049cc66eaSRichard Alpe const struct nla_policy tipc_nl_net_policy[TIPC_NLA_NET_MAX + 1] = { 8149cc66eaSRichard Alpe [TIPC_NLA_NET_UNSPEC] = { .type = NLA_UNSPEC }, 82ec518f21SEric Dumazet [TIPC_NLA_NET_ID] = { .type = NLA_U32 }, 83ec518f21SEric Dumazet [TIPC_NLA_NET_ADDR] = { .type = NLA_U32 }, 84c6404122SEric Dumazet [TIPC_NLA_NET_NODEID] = { .type = NLA_U64 }, 85c6404122SEric Dumazet [TIPC_NLA_NET_NODEID_W1] = { .type = NLA_U64 }, 86e1b5e598SJohn Rutherford [TIPC_NLA_NET_ADDR_LEGACY] = { .type = NLA_FLAG } 8749cc66eaSRichard Alpe }; 8849cc66eaSRichard Alpe 8949cc66eaSRichard Alpe const struct nla_policy tipc_nl_link_policy[TIPC_NLA_LINK_MAX + 1] = { 9049cc66eaSRichard Alpe [TIPC_NLA_LINK_UNSPEC] = { .type = NLA_UNSPEC }, 9149cc66eaSRichard Alpe [TIPC_NLA_LINK_NAME] = { .type = NLA_STRING, 9249cc66eaSRichard Alpe .len = TIPC_MAX_LINK_NAME }, 9349cc66eaSRichard Alpe [TIPC_NLA_LINK_MTU] = { .type = NLA_U32 }, 9449cc66eaSRichard Alpe [TIPC_NLA_LINK_BROADCAST] = { .type = NLA_FLAG }, 9549cc66eaSRichard Alpe [TIPC_NLA_LINK_UP] = { .type = NLA_FLAG }, 9649cc66eaSRichard Alpe [TIPC_NLA_LINK_ACTIVE] = { .type = NLA_FLAG }, 9749cc66eaSRichard Alpe [TIPC_NLA_LINK_PROP] = { .type = NLA_NESTED }, 9849cc66eaSRichard Alpe [TIPC_NLA_LINK_STATS] = { .type = NLA_NESTED }, 9949cc66eaSRichard Alpe [TIPC_NLA_LINK_RX] = { .type = NLA_U32 }, 10049cc66eaSRichard Alpe [TIPC_NLA_LINK_TX] = { .type = NLA_U32 } 10149cc66eaSRichard Alpe }; 10249cc66eaSRichard Alpe 10349cc66eaSRichard Alpe const struct nla_policy tipc_nl_node_policy[TIPC_NLA_NODE_MAX + 1] = { 10449cc66eaSRichard Alpe [TIPC_NLA_NODE_UNSPEC] = { .type = NLA_UNSPEC }, 10549cc66eaSRichard Alpe [TIPC_NLA_NODE_ADDR] = { .type = NLA_U32 }, 106e1f32190STuong Lien [TIPC_NLA_NODE_UP] = { .type = NLA_FLAG }, 107e1f32190STuong Lien [TIPC_NLA_NODE_ID] = { .type = NLA_BINARY, 108e1f32190STuong Lien .len = TIPC_NODEID_LEN}, 109e1f32190STuong Lien [TIPC_NLA_NODE_KEY] = { .type = NLA_BINARY, 110e1f32190STuong Lien .len = TIPC_AEAD_KEY_SIZE_MAX}, 11149cc66eaSRichard Alpe }; 11249cc66eaSRichard Alpe 11349cc66eaSRichard Alpe /* Properties valid for media, bearer and link */ 11449cc66eaSRichard Alpe const struct nla_policy tipc_nl_prop_policy[TIPC_NLA_PROP_MAX + 1] = { 11549cc66eaSRichard Alpe [TIPC_NLA_PROP_UNSPEC] = { .type = NLA_UNSPEC }, 11649cc66eaSRichard Alpe [TIPC_NLA_PROP_PRIO] = { .type = NLA_U32 }, 11749cc66eaSRichard Alpe [TIPC_NLA_PROP_TOL] = { .type = NLA_U32 }, 11802ec6cafSHoang Le [TIPC_NLA_PROP_WIN] = { .type = NLA_U32 }, 119213320a6SJakub Kicinski [TIPC_NLA_PROP_MTU] = { .type = NLA_U32 }, 12002ec6cafSHoang Le [TIPC_NLA_PROP_BROADCAST] = { .type = NLA_U32 }, 12102ec6cafSHoang Le [TIPC_NLA_PROP_BROADCAST_RATIO] = { .type = NLA_U32 } 12249cc66eaSRichard Alpe }; 12349cc66eaSRichard Alpe 12449cc66eaSRichard Alpe const struct nla_policy tipc_nl_bearer_policy[TIPC_NLA_BEARER_MAX + 1] = { 12549cc66eaSRichard Alpe [TIPC_NLA_BEARER_UNSPEC] = { .type = NLA_UNSPEC }, 12649cc66eaSRichard Alpe [TIPC_NLA_BEARER_NAME] = { .type = NLA_STRING, 12749cc66eaSRichard Alpe .len = TIPC_MAX_BEARER_NAME }, 12849cc66eaSRichard Alpe [TIPC_NLA_BEARER_PROP] = { .type = NLA_NESTED }, 12949cc66eaSRichard Alpe [TIPC_NLA_BEARER_DOMAIN] = { .type = NLA_U32 } 13049cc66eaSRichard Alpe }; 13149cc66eaSRichard Alpe 13249cc66eaSRichard Alpe const struct nla_policy tipc_nl_media_policy[TIPC_NLA_MEDIA_MAX + 1] = { 13349cc66eaSRichard Alpe [TIPC_NLA_MEDIA_UNSPEC] = { .type = NLA_UNSPEC }, 13449cc66eaSRichard Alpe [TIPC_NLA_MEDIA_NAME] = { .type = NLA_STRING }, 13549cc66eaSRichard Alpe [TIPC_NLA_MEDIA_PROP] = { .type = NLA_NESTED } 13649cc66eaSRichard Alpe }; 13749cc66eaSRichard Alpe 13849cc66eaSRichard Alpe const struct nla_policy tipc_nl_udp_policy[TIPC_NLA_UDP_MAX + 1] = { 13949cc66eaSRichard Alpe [TIPC_NLA_UDP_UNSPEC] = {.type = NLA_UNSPEC}, 14049cc66eaSRichard Alpe [TIPC_NLA_UDP_LOCAL] = {.type = NLA_BINARY, 14149cc66eaSRichard Alpe .len = sizeof(struct sockaddr_storage)}, 14249cc66eaSRichard Alpe [TIPC_NLA_UDP_REMOTE] = {.type = NLA_BINARY, 14349cc66eaSRichard Alpe .len = sizeof(struct sockaddr_storage)}, 14449cc66eaSRichard Alpe }; 14549cc66eaSRichard Alpe 1460655f6a8SRichard Alpe /* Users of the legacy API (tipc-config) can't handle that we add operations, 1470655f6a8SRichard Alpe * so we have a separate genl handling for the new API. 1480655f6a8SRichard Alpe */ 1490655f6a8SRichard Alpe static const struct genl_ops tipc_genl_v2_ops[] = { 1500655f6a8SRichard Alpe { 1510655f6a8SRichard Alpe .cmd = TIPC_NL_BEARER_DISABLE, 152ef6243acSJohannes Berg .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 1530655f6a8SRichard Alpe .doit = tipc_nl_bearer_disable, 1540655f6a8SRichard Alpe }, 1550655f6a8SRichard Alpe { 1560655f6a8SRichard Alpe .cmd = TIPC_NL_BEARER_ENABLE, 157ef6243acSJohannes Berg .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 1580655f6a8SRichard Alpe .doit = tipc_nl_bearer_enable, 15935b9dd76SRichard Alpe }, 16035b9dd76SRichard Alpe { 16135b9dd76SRichard Alpe .cmd = TIPC_NL_BEARER_GET, 162ef6243acSJohannes Berg .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 16335b9dd76SRichard Alpe .doit = tipc_nl_bearer_get, 16435b9dd76SRichard Alpe .dumpit = tipc_nl_bearer_dump, 165315c00bcSRichard Alpe }, 166315c00bcSRichard Alpe { 167ef20cd4dSRichard Alpe .cmd = TIPC_NL_BEARER_ADD, 168ef6243acSJohannes Berg .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 169ef20cd4dSRichard Alpe .doit = tipc_nl_bearer_add, 170ef20cd4dSRichard Alpe }, 171ef20cd4dSRichard Alpe { 172315c00bcSRichard Alpe .cmd = TIPC_NL_BEARER_SET, 173ef6243acSJohannes Berg .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 174315c00bcSRichard Alpe .doit = tipc_nl_bearer_set, 17534b78a12SRichard Alpe }, 17634b78a12SRichard Alpe { 17734b78a12SRichard Alpe .cmd = TIPC_NL_SOCK_GET, 178ef6243acSJohannes Berg .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 1799a07efa9SCong Wang .start = tipc_dump_start, 18034b78a12SRichard Alpe .dumpit = tipc_nl_sk_dump, 1819a07efa9SCong Wang .done = tipc_dump_done, 1821a1a143dSRichard Alpe }, 1831a1a143dSRichard Alpe { 1841a1a143dSRichard Alpe .cmd = TIPC_NL_PUBL_GET, 185057af707SJiri Pirko .validate = GENL_DONT_VALIDATE_STRICT | 186057af707SJiri Pirko GENL_DONT_VALIDATE_DUMP_STRICT, 1871a1a143dSRichard Alpe .dumpit = tipc_nl_publ_dump, 1887be57fc6SRichard Alpe }, 1897be57fc6SRichard Alpe { 1907be57fc6SRichard Alpe .cmd = TIPC_NL_LINK_GET, 191*03b6fefdSTuong Lien .validate = GENL_DONT_VALIDATE_STRICT, 1925be9c086SJon Paul Maloy .doit = tipc_nl_node_get_link, 19338206d59SJon Paul Maloy .dumpit = tipc_nl_node_dump_link, 194f96ce7a2SRichard Alpe }, 195f96ce7a2SRichard Alpe { 196f96ce7a2SRichard Alpe .cmd = TIPC_NL_LINK_SET, 197ef6243acSJohannes Berg .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 1985be9c086SJon Paul Maloy .doit = tipc_nl_node_set_link, 199ae36342bSRichard Alpe }, 200ae36342bSRichard Alpe { 201ae36342bSRichard Alpe .cmd = TIPC_NL_LINK_RESET_STATS, 202ef6243acSJohannes Berg .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 2035be9c086SJon Paul Maloy .doit = tipc_nl_node_reset_link_stats, 20446f15c67SRichard Alpe }, 20546f15c67SRichard Alpe { 20646f15c67SRichard Alpe .cmd = TIPC_NL_MEDIA_GET, 207ef6243acSJohannes Berg .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 20846f15c67SRichard Alpe .doit = tipc_nl_media_get, 20946f15c67SRichard Alpe .dumpit = tipc_nl_media_dump, 2101e55417dSRichard Alpe }, 2111e55417dSRichard Alpe { 2121e55417dSRichard Alpe .cmd = TIPC_NL_MEDIA_SET, 213ef6243acSJohannes Berg .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 2141e55417dSRichard Alpe .doit = tipc_nl_media_set, 2153e4b6ab5SRichard Alpe }, 2163e4b6ab5SRichard Alpe { 2173e4b6ab5SRichard Alpe .cmd = TIPC_NL_NODE_GET, 218ef6243acSJohannes Berg .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 2193e4b6ab5SRichard Alpe .dumpit = tipc_nl_node_dump, 220fd3cf2adSRichard Alpe }, 221fd3cf2adSRichard Alpe { 222fd3cf2adSRichard Alpe .cmd = TIPC_NL_NET_GET, 223ef6243acSJohannes Berg .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 224fd3cf2adSRichard Alpe .dumpit = tipc_nl_net_dump, 22527c21416SRichard Alpe }, 22627c21416SRichard Alpe { 22727c21416SRichard Alpe .cmd = TIPC_NL_NET_SET, 228ef6243acSJohannes Berg .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 22927c21416SRichard Alpe .doit = tipc_nl_net_set, 2301593123aSRichard Alpe }, 2311593123aSRichard Alpe { 2321593123aSRichard Alpe .cmd = TIPC_NL_NAME_TABLE_GET, 233ef6243acSJohannes Berg .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 2341593123aSRichard Alpe .dumpit = tipc_nl_name_table_dump, 2357b3f5229SParthasarathy Bhuvaragan }, 2367b3f5229SParthasarathy Bhuvaragan { 2377b3f5229SParthasarathy Bhuvaragan .cmd = TIPC_NL_MON_SET, 238ef6243acSJohannes Berg .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 2397b3f5229SParthasarathy Bhuvaragan .doit = tipc_nl_node_set_monitor, 2407b3f5229SParthasarathy Bhuvaragan }, 241bf1035b2SParthasarathy Bhuvaragan { 242bf1035b2SParthasarathy Bhuvaragan .cmd = TIPC_NL_MON_GET, 243ef6243acSJohannes Berg .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 244bf1035b2SParthasarathy Bhuvaragan .doit = tipc_nl_node_get_monitor, 245cf6f7e1dSParthasarathy Bhuvaragan .dumpit = tipc_nl_node_dump_monitor, 246cf6f7e1dSParthasarathy Bhuvaragan }, 247cf6f7e1dSParthasarathy Bhuvaragan { 248cf6f7e1dSParthasarathy Bhuvaragan .cmd = TIPC_NL_MON_PEER_GET, 249057af707SJiri Pirko .validate = GENL_DONT_VALIDATE_STRICT | 250057af707SJiri Pirko GENL_DONT_VALIDATE_DUMP_STRICT, 251cf6f7e1dSParthasarathy Bhuvaragan .dumpit = tipc_nl_node_dump_monitor_peer, 252bf1035b2SParthasarathy Bhuvaragan }, 253b3404022SRichard Alpe { 254b3404022SRichard Alpe .cmd = TIPC_NL_PEER_REMOVE, 255ef6243acSJohannes Berg .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 256b3404022SRichard Alpe .doit = tipc_nl_peer_rm, 257832629caSRichard Alpe }, 258832629caSRichard Alpe #ifdef CONFIG_TIPC_MEDIA_UDP 259832629caSRichard Alpe { 260832629caSRichard Alpe .cmd = TIPC_NL_UDP_GET_REMOTEIP, 261057af707SJiri Pirko .validate = GENL_DONT_VALIDATE_STRICT | 262057af707SJiri Pirko GENL_DONT_VALIDATE_DUMP_STRICT, 263832629caSRichard Alpe .dumpit = tipc_udp_nl_dump_remoteip, 264832629caSRichard Alpe }, 265832629caSRichard Alpe #endif 266e1f32190STuong Lien #ifdef CONFIG_TIPC_CRYPTO 267e1f32190STuong Lien { 268e1f32190STuong Lien .cmd = TIPC_NL_KEY_SET, 269e1f32190STuong Lien .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 270e1f32190STuong Lien .doit = tipc_nl_node_set_key, 271e1f32190STuong Lien }, 272e1f32190STuong Lien { 273e1f32190STuong Lien .cmd = TIPC_NL_KEY_FLUSH, 274e1f32190STuong Lien .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 275e1f32190STuong Lien .doit = tipc_nl_node_flush_key, 276e1f32190STuong Lien }, 277e1f32190STuong Lien #endif 278e1b5e598SJohn Rutherford { 279e1b5e598SJohn Rutherford .cmd = TIPC_NL_ADDR_LEGACY_GET, 280e1b5e598SJohn Rutherford .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 281e1b5e598SJohn Rutherford .doit = tipc_nl_net_addr_legacy_get, 282e1b5e598SJohn Rutherford }, 2830655f6a8SRichard Alpe }; 2840655f6a8SRichard Alpe 28556989f6dSJohannes Berg struct genl_family tipc_genl_family __ro_after_init = { 286489111e5SJohannes Berg .name = TIPC_GENL_V2_NAME, 287489111e5SJohannes Berg .version = TIPC_GENL_V2_VERSION, 288489111e5SJohannes Berg .hdrsize = 0, 289489111e5SJohannes Berg .maxattr = TIPC_NLA_MAX, 2903b0f31f2SJohannes Berg .policy = tipc_nl_policy, 291489111e5SJohannes Berg .netnsok = true, 292489111e5SJohannes Berg .module = THIS_MODULE, 293489111e5SJohannes Berg .ops = tipc_genl_v2_ops, 294489111e5SJohannes Berg .n_ops = ARRAY_SIZE(tipc_genl_v2_ops), 295489111e5SJohannes Berg }; 296489111e5SJohannes Berg 29756989f6dSJohannes Berg int __init tipc_netlink_start(void) 298b97bf3fdSPer Liden { 299acb0a200SMichał Mirosław int res; 300b70e4f45SJon Maloy 301489111e5SJohannes Berg res = genl_register_family(&tipc_genl_family); 3020655f6a8SRichard Alpe if (res) { 3032cf8aa19SErik Hugne pr_err("Failed to register netlink interface\n"); 304acb0a200SMichał Mirosław return res; 305acb0a200SMichał Mirosław } 306acb0a200SMichał Mirosław return 0; 307b97bf3fdSPer Liden } 308b97bf3fdSPer Liden 3094323add6SPer Liden void tipc_netlink_stop(void) 310b97bf3fdSPer Liden { 311acb0a200SMichał Mirosław genl_unregister_family(&tipc_genl_family); 312b97bf3fdSPer Liden } 313