Blame view

net/tipc/netlink.c 10.1 KB
b97bf3fd8   Per Liden   [TIPC] Initial merge
1
2
  /*
   * net/tipc/netlink.c: TIPC configuration handling
c43072852   YOSHIFUJI Hideaki   [NET] TIPC: Fix w...
3
   *
0655f6a86   Richard Alpe   tipc: add bearer ...
4
   * Copyright (c) 2005-2006, 2014, Ericsson AB
59f0c4523   Allan Stephens   tipc: Fix skb_und...
5
   * Copyright (c) 2005-2007, Wind River Systems
b97bf3fd8   Per Liden   [TIPC] Initial merge
6
7
   * All rights reserved.
   *
9ea1fd3c1   Per Liden   [TIPC] License he...
8
   * Redistribution and use in source and binary forms, with or without
b97bf3fd8   Per Liden   [TIPC] Initial merge
9
10
   * modification, are permitted provided that the following conditions are met:
   *
9ea1fd3c1   Per Liden   [TIPC] License he...
11
12
13
14
15
16
17
18
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in the
   *    documentation and/or other materials provided with the distribution.
   * 3. Neither the names of the copyright holders nor the names of its
   *    contributors may be used to endorse or promote products derived from
   *    this software without specific prior written permission.
b97bf3fd8   Per Liden   [TIPC] Initial merge
19
   *
9ea1fd3c1   Per Liden   [TIPC] License he...
20
21
22
23
24
25
26
27
28
29
30
31
32
33
   * Alternatively, this software may be distributed under the terms of the
   * GNU General Public License ("GPL") version 2 as published by the Free
   * Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
b97bf3fd8   Per Liden   [TIPC] Initial merge
34
35
36
37
   * POSSIBILITY OF SUCH DAMAGE.
   */
  
  #include "core.h"
34b78a127   Richard Alpe   tipc: add sock du...
38
  #include "socket.h"
1593123a6   Richard Alpe   tipc: add name ta...
39
  #include "name_table.h"
0655f6a86   Richard Alpe   tipc: add bearer ...
40
  #include "bearer.h"
7be57fc69   Richard Alpe   tipc: add link ge...
41
  #include "link.h"
3e4b6ab58   Richard Alpe   tipc: add node ge...
42
  #include "node.h"
fd3cf2ad5   Richard Alpe   tipc: add net dum...
43
  #include "net.h"
832629ca5   Richard Alpe   tipc: add UDP rem...
44
  #include "udp_media.h"
b97bf3fd8   Per Liden   [TIPC] Initial merge
45
  #include <net/genetlink.h>
0655f6a86   Richard Alpe   tipc: add bearer ...
46
47
48
  static const struct nla_policy tipc_nl_policy[TIPC_NLA_MAX + 1] = {
  	[TIPC_NLA_UNSPEC]	= { .type = NLA_UNSPEC, },
  	[TIPC_NLA_BEARER]	= { .type = NLA_NESTED, },
34b78a127   Richard Alpe   tipc: add sock du...
49
  	[TIPC_NLA_SOCK]		= { .type = NLA_NESTED, },
7be57fc69   Richard Alpe   tipc: add link ge...
50
51
  	[TIPC_NLA_PUBL]		= { .type = NLA_NESTED, },
  	[TIPC_NLA_LINK]		= { .type = NLA_NESTED, },
46f15c679   Richard Alpe   tipc: add media g...
52
  	[TIPC_NLA_MEDIA]	= { .type = NLA_NESTED, },
fd3cf2ad5   Richard Alpe   tipc: add net dum...
53
  	[TIPC_NLA_NODE]		= { .type = NLA_NESTED, },
1593123a6   Richard Alpe   tipc: add name ta...
54
  	[TIPC_NLA_NET]		= { .type = NLA_NESTED, },
7b3f52296   Parthasarathy Bhuvaragan   tipc: make cluste...
55
56
  	[TIPC_NLA_NAME_TABLE]	= { .type = NLA_NESTED, },
  	[TIPC_NLA_MON]		= { .type = NLA_NESTED, },
0655f6a86   Richard Alpe   tipc: add bearer ...
57
  };
49cc66eae   Richard Alpe   tipc: move netlin...
58
59
60
61
62
  const struct nla_policy
  tipc_nl_name_table_policy[TIPC_NLA_NAME_TABLE_MAX + 1] = {
  	[TIPC_NLA_NAME_TABLE_UNSPEC]	= { .type = NLA_UNSPEC },
  	[TIPC_NLA_NAME_TABLE_PUBL]	= { .type = NLA_NESTED }
  };
7b3f52296   Parthasarathy Bhuvaragan   tipc: make cluste...
63
64
  const struct nla_policy tipc_nl_monitor_policy[TIPC_NLA_MON_MAX + 1] = {
  	[TIPC_NLA_MON_UNSPEC]			= { .type = NLA_UNSPEC },
cf6f7e1d5   Parthasarathy Bhuvaragan   tipc: dump monito...
65
  	[TIPC_NLA_MON_REF]			= { .type = NLA_U32 },
7b3f52296   Parthasarathy Bhuvaragan   tipc: make cluste...
66
67
  	[TIPC_NLA_MON_ACTIVATION_THRESHOLD]	= { .type = NLA_U32 },
  };
49cc66eae   Richard Alpe   tipc: move netlin...
68
69
70
71
72
73
74
75
76
77
  const struct nla_policy tipc_nl_sock_policy[TIPC_NLA_SOCK_MAX + 1] = {
  	[TIPC_NLA_SOCK_UNSPEC]		= { .type = NLA_UNSPEC },
  	[TIPC_NLA_SOCK_ADDR]		= { .type = NLA_U32 },
  	[TIPC_NLA_SOCK_REF]		= { .type = NLA_U32 },
  	[TIPC_NLA_SOCK_CON]		= { .type = NLA_NESTED },
  	[TIPC_NLA_SOCK_HAS_PUBL]	= { .type = NLA_FLAG }
  };
  
  const struct nla_policy tipc_nl_net_policy[TIPC_NLA_NET_MAX + 1] = {
  	[TIPC_NLA_NET_UNSPEC]		= { .type = NLA_UNSPEC },
ec518f21c   Eric Dumazet   tipc: add policy ...
78
79
  	[TIPC_NLA_NET_ID]		= { .type = NLA_U32 },
  	[TIPC_NLA_NET_ADDR]		= { .type = NLA_U32 },
c6404122c   Eric Dumazet   tipc: fix possibl...
80
81
  	[TIPC_NLA_NET_NODEID]		= { .type = NLA_U64 },
  	[TIPC_NLA_NET_NODEID_W1]	= { .type = NLA_U64 },
e1b5e598e   John Rutherford   tipc: make legacy...
82
  	[TIPC_NLA_NET_ADDR_LEGACY]	= { .type = NLA_FLAG }
49cc66eae   Richard Alpe   tipc: move netlin...
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
  };
  
  const struct nla_policy tipc_nl_link_policy[TIPC_NLA_LINK_MAX + 1] = {
  	[TIPC_NLA_LINK_UNSPEC]		= { .type = NLA_UNSPEC },
  	[TIPC_NLA_LINK_NAME]		= { .type = NLA_STRING,
  					    .len = TIPC_MAX_LINK_NAME },
  	[TIPC_NLA_LINK_MTU]		= { .type = NLA_U32 },
  	[TIPC_NLA_LINK_BROADCAST]	= { .type = NLA_FLAG },
  	[TIPC_NLA_LINK_UP]		= { .type = NLA_FLAG },
  	[TIPC_NLA_LINK_ACTIVE]		= { .type = NLA_FLAG },
  	[TIPC_NLA_LINK_PROP]		= { .type = NLA_NESTED },
  	[TIPC_NLA_LINK_STATS]		= { .type = NLA_NESTED },
  	[TIPC_NLA_LINK_RX]		= { .type = NLA_U32 },
  	[TIPC_NLA_LINK_TX]		= { .type = NLA_U32 }
  };
  
  const struct nla_policy tipc_nl_node_policy[TIPC_NLA_NODE_MAX + 1] = {
  	[TIPC_NLA_NODE_UNSPEC]		= { .type = NLA_UNSPEC },
  	[TIPC_NLA_NODE_ADDR]		= { .type = NLA_U32 },
e1f32190c   Tuong Lien   tipc: add support...
102
103
104
105
106
  	[TIPC_NLA_NODE_UP]		= { .type = NLA_FLAG },
  	[TIPC_NLA_NODE_ID]		= { .type = NLA_BINARY,
  					    .len = TIPC_NODEID_LEN},
  	[TIPC_NLA_NODE_KEY]		= { .type = NLA_BINARY,
  					    .len = TIPC_AEAD_KEY_SIZE_MAX},
daef1ee37   Tuong Lien   tipc: introduce e...
107
  	[TIPC_NLA_NODE_KEY_MASTER]	= { .type = NLA_FLAG },
23700da29   Tuong Lien   tipc: add automat...
108
  	[TIPC_NLA_NODE_REKEYING]	= { .type = NLA_U32 },
49cc66eae   Richard Alpe   tipc: move netlin...
109
110
111
112
113
114
115
  };
  
  /* Properties valid for media, bearer and link */
  const struct nla_policy tipc_nl_prop_policy[TIPC_NLA_PROP_MAX + 1] = {
  	[TIPC_NLA_PROP_UNSPEC]		= { .type = NLA_UNSPEC },
  	[TIPC_NLA_PROP_PRIO]		= { .type = NLA_U32 },
  	[TIPC_NLA_PROP_TOL]		= { .type = NLA_U32 },
02ec6cafd   Hoang Le   tipc: support bro...
116
  	[TIPC_NLA_PROP_WIN]		= { .type = NLA_U32 },
213320a67   Jakub Kicinski   tipc: add missing...
117
  	[TIPC_NLA_PROP_MTU]		= { .type = NLA_U32 },
02ec6cafd   Hoang Le   tipc: support bro...
118
119
  	[TIPC_NLA_PROP_BROADCAST]	= { .type = NLA_U32 },
  	[TIPC_NLA_PROP_BROADCAST_RATIO]	= { .type = NLA_U32 }
49cc66eae   Richard Alpe   tipc: move netlin...
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
  };
  
  const struct nla_policy tipc_nl_bearer_policy[TIPC_NLA_BEARER_MAX + 1]	= {
  	[TIPC_NLA_BEARER_UNSPEC]	= { .type = NLA_UNSPEC },
  	[TIPC_NLA_BEARER_NAME]		= { .type = NLA_STRING,
  					    .len = TIPC_MAX_BEARER_NAME },
  	[TIPC_NLA_BEARER_PROP]		= { .type = NLA_NESTED },
  	[TIPC_NLA_BEARER_DOMAIN]	= { .type = NLA_U32 }
  };
  
  const struct nla_policy tipc_nl_media_policy[TIPC_NLA_MEDIA_MAX + 1] = {
  	[TIPC_NLA_MEDIA_UNSPEC]		= { .type = NLA_UNSPEC },
  	[TIPC_NLA_MEDIA_NAME]		= { .type = NLA_STRING },
  	[TIPC_NLA_MEDIA_PROP]		= { .type = NLA_NESTED }
  };
  
  const struct nla_policy tipc_nl_udp_policy[TIPC_NLA_UDP_MAX + 1] = {
  	[TIPC_NLA_UDP_UNSPEC]	= {.type = NLA_UNSPEC},
  	[TIPC_NLA_UDP_LOCAL]	= {.type = NLA_BINARY,
  				   .len = sizeof(struct sockaddr_storage)},
  	[TIPC_NLA_UDP_REMOTE]	= {.type = NLA_BINARY,
  				   .len = sizeof(struct sockaddr_storage)},
  };
0655f6a86   Richard Alpe   tipc: add bearer ...
143
144
145
  /* Users of the legacy API (tipc-config) can't handle that we add operations,
   * so we have a separate genl handling for the new API.
   */
0655f6a86   Richard Alpe   tipc: add bearer ...
146
147
148
  static const struct genl_ops tipc_genl_v2_ops[] = {
  	{
  		.cmd	= TIPC_NL_BEARER_DISABLE,
ef6243acb   Johannes Berg   genetlink: option...
149
  		.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
0655f6a86   Richard Alpe   tipc: add bearer ...
150
  		.doit	= tipc_nl_bearer_disable,
0655f6a86   Richard Alpe   tipc: add bearer ...
151
152
153
  	},
  	{
  		.cmd	= TIPC_NL_BEARER_ENABLE,
ef6243acb   Johannes Berg   genetlink: option...
154
  		.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
0655f6a86   Richard Alpe   tipc: add bearer ...
155
  		.doit	= tipc_nl_bearer_enable,
35b9dd760   Richard Alpe   tipc: add bearer ...
156
157
158
  	},
  	{
  		.cmd	= TIPC_NL_BEARER_GET,
ef6243acb   Johannes Berg   genetlink: option...
159
  		.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
35b9dd760   Richard Alpe   tipc: add bearer ...
160
161
  		.doit	= tipc_nl_bearer_get,
  		.dumpit	= tipc_nl_bearer_dump,
315c00bc9   Richard Alpe   tipc: add bearer ...
162
163
  	},
  	{
ef20cd4dd   Richard Alpe   tipc: introduce U...
164
  		.cmd	= TIPC_NL_BEARER_ADD,
ef6243acb   Johannes Berg   genetlink: option...
165
  		.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
ef20cd4dd   Richard Alpe   tipc: introduce U...
166
  		.doit	= tipc_nl_bearer_add,
ef20cd4dd   Richard Alpe   tipc: introduce U...
167
168
  	},
  	{
315c00bc9   Richard Alpe   tipc: add bearer ...
169
  		.cmd	= TIPC_NL_BEARER_SET,
ef6243acb   Johannes Berg   genetlink: option...
170
  		.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
315c00bc9   Richard Alpe   tipc: add bearer ...
171
  		.doit	= tipc_nl_bearer_set,
34b78a127   Richard Alpe   tipc: add sock du...
172
173
174
  	},
  	{
  		.cmd	= TIPC_NL_SOCK_GET,
ef6243acb   Johannes Berg   genetlink: option...
175
  		.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
9a07efa9a   Cong Wang   tipc: switch to r...
176
  		.start = tipc_dump_start,
34b78a127   Richard Alpe   tipc: add sock du...
177
  		.dumpit	= tipc_nl_sk_dump,
9a07efa9a   Cong Wang   tipc: switch to r...
178
  		.done	= tipc_dump_done,
1a1a143da   Richard Alpe   tipc: add publica...
179
180
181
  	},
  	{
  		.cmd	= TIPC_NL_PUBL_GET,
057af7071   Jiri Pirko   net: tipc: have g...
182
183
  		.validate = GENL_DONT_VALIDATE_STRICT |
  			    GENL_DONT_VALIDATE_DUMP_STRICT,
1a1a143da   Richard Alpe   tipc: add publica...
184
  		.dumpit	= tipc_nl_publ_dump,
7be57fc69   Richard Alpe   tipc: add link ge...
185
186
187
  	},
  	{
  		.cmd	= TIPC_NL_LINK_GET,
03b6fefd9   Tuong Lien   tipc: add support...
188
  		.validate = GENL_DONT_VALIDATE_STRICT,
5be9c0867   Jon Paul Maloy   tipc: narrow down...
189
  		.doit   = tipc_nl_node_get_link,
38206d593   Jon Paul Maloy   tipc: narrow down...
190
  		.dumpit	= tipc_nl_node_dump_link,
f96ce7a20   Richard Alpe   tipc: add link se...
191
192
193
  	},
  	{
  		.cmd	= TIPC_NL_LINK_SET,
ef6243acb   Johannes Berg   genetlink: option...
194
  		.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
5be9c0867   Jon Paul Maloy   tipc: narrow down...
195
  		.doit	= tipc_nl_node_set_link,
ae36342b5   Richard Alpe   tipc: add link st...
196
197
198
  	},
  	{
  		.cmd	= TIPC_NL_LINK_RESET_STATS,
ef6243acb   Johannes Berg   genetlink: option...
199
  		.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
5be9c0867   Jon Paul Maloy   tipc: narrow down...
200
  		.doit   = tipc_nl_node_reset_link_stats,
46f15c679   Richard Alpe   tipc: add media g...
201
202
203
  	},
  	{
  		.cmd	= TIPC_NL_MEDIA_GET,
ef6243acb   Johannes Berg   genetlink: option...
204
  		.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
46f15c679   Richard Alpe   tipc: add media g...
205
206
  		.doit	= tipc_nl_media_get,
  		.dumpit	= tipc_nl_media_dump,
1e55417d8   Richard Alpe   tipc: add media s...
207
208
209
  	},
  	{
  		.cmd	= TIPC_NL_MEDIA_SET,
ef6243acb   Johannes Berg   genetlink: option...
210
  		.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
1e55417d8   Richard Alpe   tipc: add media s...
211
  		.doit	= tipc_nl_media_set,
3e4b6ab58   Richard Alpe   tipc: add node ge...
212
213
214
  	},
  	{
  		.cmd	= TIPC_NL_NODE_GET,
ef6243acb   Johannes Berg   genetlink: option...
215
  		.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
3e4b6ab58   Richard Alpe   tipc: add node ge...
216
  		.dumpit	= tipc_nl_node_dump,
fd3cf2ad5   Richard Alpe   tipc: add net dum...
217
218
219
  	},
  	{
  		.cmd	= TIPC_NL_NET_GET,
ef6243acb   Johannes Berg   genetlink: option...
220
  		.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
fd3cf2ad5   Richard Alpe   tipc: add net dum...
221
  		.dumpit	= tipc_nl_net_dump,
27c214167   Richard Alpe   tipc: add net set...
222
223
224
  	},
  	{
  		.cmd	= TIPC_NL_NET_SET,
ef6243acb   Johannes Berg   genetlink: option...
225
  		.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
27c214167   Richard Alpe   tipc: add net set...
226
  		.doit	= tipc_nl_net_set,
1593123a6   Richard Alpe   tipc: add name ta...
227
228
229
  	},
  	{
  		.cmd	= TIPC_NL_NAME_TABLE_GET,
ef6243acb   Johannes Berg   genetlink: option...
230
  		.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
1593123a6   Richard Alpe   tipc: add name ta...
231
  		.dumpit	= tipc_nl_name_table_dump,
7b3f52296   Parthasarathy Bhuvaragan   tipc: make cluste...
232
233
234
  	},
  	{
  		.cmd	= TIPC_NL_MON_SET,
ef6243acb   Johannes Berg   genetlink: option...
235
  		.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
7b3f52296   Parthasarathy Bhuvaragan   tipc: make cluste...
236
  		.doit	= tipc_nl_node_set_monitor,
7b3f52296   Parthasarathy Bhuvaragan   tipc: make cluste...
237
  	},
bf1035b2f   Parthasarathy Bhuvaragan   tipc: get monitor...
238
239
  	{
  		.cmd	= TIPC_NL_MON_GET,
ef6243acb   Johannes Berg   genetlink: option...
240
  		.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
bf1035b2f   Parthasarathy Bhuvaragan   tipc: get monitor...
241
  		.doit	= tipc_nl_node_get_monitor,
cf6f7e1d5   Parthasarathy Bhuvaragan   tipc: dump monito...
242
  		.dumpit	= tipc_nl_node_dump_monitor,
cf6f7e1d5   Parthasarathy Bhuvaragan   tipc: dump monito...
243
244
245
  	},
  	{
  		.cmd	= TIPC_NL_MON_PEER_GET,
057af7071   Jiri Pirko   net: tipc: have g...
246
247
  		.validate = GENL_DONT_VALIDATE_STRICT |
  			    GENL_DONT_VALIDATE_DUMP_STRICT,
cf6f7e1d5   Parthasarathy Bhuvaragan   tipc: dump monito...
248
  		.dumpit	= tipc_nl_node_dump_monitor_peer,
bf1035b2f   Parthasarathy Bhuvaragan   tipc: get monitor...
249
  	},
b34040227   Richard Alpe   tipc: add peer re...
250
251
  	{
  		.cmd	= TIPC_NL_PEER_REMOVE,
ef6243acb   Johannes Berg   genetlink: option...
252
  		.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
b34040227   Richard Alpe   tipc: add peer re...
253
  		.doit	= tipc_nl_peer_rm,
832629ca5   Richard Alpe   tipc: add UDP rem...
254
255
256
257
  	},
  #ifdef CONFIG_TIPC_MEDIA_UDP
  	{
  		.cmd	= TIPC_NL_UDP_GET_REMOTEIP,
057af7071   Jiri Pirko   net: tipc: have g...
258
259
  		.validate = GENL_DONT_VALIDATE_STRICT |
  			    GENL_DONT_VALIDATE_DUMP_STRICT,
832629ca5   Richard Alpe   tipc: add UDP rem...
260
  		.dumpit	= tipc_udp_nl_dump_remoteip,
832629ca5   Richard Alpe   tipc: add UDP rem...
261
262
  	},
  #endif
e1f32190c   Tuong Lien   tipc: add support...
263
264
265
266
267
268
269
270
271
272
273
274
  #ifdef CONFIG_TIPC_CRYPTO
  	{
  		.cmd	= TIPC_NL_KEY_SET,
  		.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
  		.doit	= tipc_nl_node_set_key,
  	},
  	{
  		.cmd	= TIPC_NL_KEY_FLUSH,
  		.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
  		.doit	= tipc_nl_node_flush_key,
  	},
  #endif
e1b5e598e   John Rutherford   tipc: make legacy...
275
276
277
278
279
  	{
  		.cmd	= TIPC_NL_ADDR_LEGACY_GET,
  		.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
  		.doit	= tipc_nl_net_addr_legacy_get,
  	},
0655f6a86   Richard Alpe   tipc: add bearer ...
280
  };
56989f6d8   Johannes Berg   genetlink: mark f...
281
  struct genl_family tipc_genl_family __ro_after_init = {
489111e5c   Johannes Berg   genetlink: static...
282
283
284
285
  	.name		= TIPC_GENL_V2_NAME,
  	.version	= TIPC_GENL_V2_VERSION,
  	.hdrsize	= 0,
  	.maxattr	= TIPC_NLA_MAX,
c04b6ea4e   john.rutherford@dektech.com.au   tipc: fix missing...
286
  	.policy		= tipc_nl_policy,
489111e5c   Johannes Berg   genetlink: static...
287
288
289
290
291
  	.netnsok	= true,
  	.module		= THIS_MODULE,
  	.ops		= tipc_genl_v2_ops,
  	.n_ops		= ARRAY_SIZE(tipc_genl_v2_ops),
  };
56989f6d8   Johannes Berg   genetlink: mark f...
292
  int __init tipc_netlink_start(void)
b97bf3fd8   Per Liden   [TIPC] Initial merge
293
  {
acb0a200a   Michał Mirosław   tipc: Use genl_re...
294
  	int res;
b70e4f45a   Jon Maloy   [TIPC} Fixed bug ...
295

489111e5c   Johannes Berg   genetlink: static...
296
  	res = genl_register_family(&tipc_genl_family);
0655f6a86   Richard Alpe   tipc: add bearer ...
297
  	if (res) {
2cf8aa19f   Erik Hugne   tipc: use standar...
298
299
  		pr_err("Failed to register netlink interface
  ");
acb0a200a   Michał Mirosław   tipc: Use genl_re...
300
301
  		return res;
  	}
c43072852   YOSHIFUJI Hideaki   [NET] TIPC: Fix w...
302
  	return 0;
b97bf3fd8   Per Liden   [TIPC] Initial merge
303
  }
4323add67   Per Liden   [TIPC] Avoid poll...
304
  void tipc_netlink_stop(void)
b97bf3fd8   Per Liden   [TIPC] Initial merge
305
  {
acb0a200a   Michał Mirosław   tipc: Use genl_re...
306
  	genl_unregister_family(&tipc_genl_family);
b97bf3fd8   Per Liden   [TIPC] Initial merge
307
  }