blob: 324a0e1143e7b8a303f6520ccff1a6654ec0d2d1 [file] [log] [blame]
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001/* SPDX-License-Identifier: MIT */
2/* Copyright (C) 2016-2018 B.A.T.M.A.N. contributors:
3 *
4 * Matthias Schiffer
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25#ifndef _UAPI_LINUX_BATMAN_ADV_H_
26#define _UAPI_LINUX_BATMAN_ADV_H_
27
28#define BATADV_NL_NAME "batadv"
29
30#define BATADV_NL_MCAST_GROUP_TPMETER "tpmeter"
31
32/**
33 * enum batadv_tt_client_flags - TT client specific flags
34 *
35 * Bits from 0 to 7 are called _remote flags_ because they are sent on the wire.
36 * Bits from 8 to 15 are called _local flags_ because they are used for local
37 * computations only.
38 *
39 * Bits from 4 to 7 - a subset of remote flags - are ensured to be in sync with
40 * the other nodes in the network. To achieve this goal these flags are included
41 * in the TT CRC computation.
42 */
43enum batadv_tt_client_flags {
44 /**
45 * @BATADV_TT_CLIENT_DEL: the client has to be deleted from the table
46 */
47 BATADV_TT_CLIENT_DEL = (1 << 0),
48
49 /**
50 * @BATADV_TT_CLIENT_ROAM: the client roamed to/from another node and
51 * the new update telling its new real location has not been
52 * received/sent yet
53 */
54 BATADV_TT_CLIENT_ROAM = (1 << 1),
55
56 /**
57 * @BATADV_TT_CLIENT_WIFI: this client is connected through a wifi
58 * interface. This information is used by the "AP Isolation" feature
59 */
60 BATADV_TT_CLIENT_WIFI = (1 << 4),
61
62 /**
63 * @BATADV_TT_CLIENT_ISOLA: this client is considered "isolated". This
64 * information is used by the Extended Isolation feature
65 */
66 BATADV_TT_CLIENT_ISOLA = (1 << 5),
67
68 /**
69 * @BATADV_TT_CLIENT_NOPURGE: this client should never be removed from
70 * the table
71 */
72 BATADV_TT_CLIENT_NOPURGE = (1 << 8),
73
74 /**
75 * @BATADV_TT_CLIENT_NEW: this client has been added to the local table
76 * but has not been announced yet
77 */
78 BATADV_TT_CLIENT_NEW = (1 << 9),
79
80 /**
81 * @BATADV_TT_CLIENT_PENDING: this client is marked for removal but it
82 * is kept in the table for one more originator interval for consistency
83 * purposes
84 */
85 BATADV_TT_CLIENT_PENDING = (1 << 10),
86
87 /**
88 * @BATADV_TT_CLIENT_TEMP: this global client has been detected to be
89 * part of the network but no nnode has already announced it
90 */
91 BATADV_TT_CLIENT_TEMP = (1 << 11),
92};
93
94/**
95 * enum batadv_mcast_flags_priv - Private, own multicast flags
96 *
97 * These are internal, multicast related flags. Currently they describe certain
98 * multicast related attributes of the segment this originator bridges into the
99 * mesh.
100 *
101 * Those attributes are used to determine the public multicast flags this
102 * originator is going to announce via TT.
103 *
104 * For netlink, if BATADV_MCAST_FLAGS_BRIDGED is unset then all querier
105 * related flags are undefined.
106 */
107enum batadv_mcast_flags_priv {
108 /**
109 * @BATADV_MCAST_FLAGS_BRIDGED: There is a bridge on top of the mesh
110 * interface.
111 */
112 BATADV_MCAST_FLAGS_BRIDGED = (1 << 0),
113
114 /**
115 * @BATADV_MCAST_FLAGS_QUERIER_IPV4_EXISTS: Whether an IGMP querier
116 * exists in the mesh
117 */
118 BATADV_MCAST_FLAGS_QUERIER_IPV4_EXISTS = (1 << 1),
119
120 /**
121 * @BATADV_MCAST_FLAGS_QUERIER_IPV6_EXISTS: Whether an MLD querier
122 * exists in the mesh
123 */
124 BATADV_MCAST_FLAGS_QUERIER_IPV6_EXISTS = (1 << 2),
125
126 /**
127 * @BATADV_MCAST_FLAGS_QUERIER_IPV4_SHADOWING: If an IGMP querier
128 * exists, whether it is potentially shadowing multicast listeners
129 * (i.e. querier is behind our own bridge segment)
130 */
131 BATADV_MCAST_FLAGS_QUERIER_IPV4_SHADOWING = (1 << 3),
132
133 /**
134 * @BATADV_MCAST_FLAGS_QUERIER_IPV6_SHADOWING: If an MLD querier
135 * exists, whether it is potentially shadowing multicast listeners
136 * (i.e. querier is behind our own bridge segment)
137 */
138 BATADV_MCAST_FLAGS_QUERIER_IPV6_SHADOWING = (1 << 4),
139};
140
141/**
142 * enum batadv_nl_attrs - batman-adv netlink attributes
143 */
144enum batadv_nl_attrs {
145 /**
146 * @BATADV_ATTR_UNSPEC: unspecified attribute to catch errors
147 */
148 BATADV_ATTR_UNSPEC,
149
150 /**
151 * @BATADV_ATTR_VERSION: batman-adv version string
152 */
153 BATADV_ATTR_VERSION,
154
155 /**
156 * @BATADV_ATTR_ALGO_NAME: name of routing algorithm
157 */
158 BATADV_ATTR_ALGO_NAME,
159
160 /**
161 * @BATADV_ATTR_MESH_IFINDEX: index of the batman-adv interface
162 */
163 BATADV_ATTR_MESH_IFINDEX,
164
165 /**
166 * @BATADV_ATTR_MESH_IFNAME: name of the batman-adv interface
167 */
168 BATADV_ATTR_MESH_IFNAME,
169
170 /**
171 * @BATADV_ATTR_MESH_ADDRESS: mac address of the batman-adv interface
172 */
173 BATADV_ATTR_MESH_ADDRESS,
174
175 /**
176 * @BATADV_ATTR_HARD_IFINDEX: index of the non-batman-adv interface
177 */
178 BATADV_ATTR_HARD_IFINDEX,
179
180 /**
181 * @BATADV_ATTR_HARD_IFNAME: name of the non-batman-adv interface
182 */
183 BATADV_ATTR_HARD_IFNAME,
184
185 /**
186 * @BATADV_ATTR_HARD_ADDRESS: mac address of the non-batman-adv
187 * interface
188 */
189 BATADV_ATTR_HARD_ADDRESS,
190
191 /**
192 * @BATADV_ATTR_ORIG_ADDRESS: originator mac address
193 */
194 BATADV_ATTR_ORIG_ADDRESS,
195
196 /**
197 * @BATADV_ATTR_TPMETER_RESULT: result of run (see
198 * batadv_tp_meter_status)
199 */
200 BATADV_ATTR_TPMETER_RESULT,
201
202 /**
203 * @BATADV_ATTR_TPMETER_TEST_TIME: time (msec) the run took
204 */
205 BATADV_ATTR_TPMETER_TEST_TIME,
206
207 /**
208 * @BATADV_ATTR_TPMETER_BYTES: amount of acked bytes during run
209 */
210 BATADV_ATTR_TPMETER_BYTES,
211
212 /**
213 * @BATADV_ATTR_TPMETER_COOKIE: session cookie to match tp_meter session
214 */
215 BATADV_ATTR_TPMETER_COOKIE,
216
217 /**
218 * @BATADV_ATTR_PAD: attribute used for padding for 64-bit alignment
219 */
220 BATADV_ATTR_PAD,
221
222 /**
223 * @BATADV_ATTR_ACTIVE: Flag indicating if the hard interface is active
224 */
225 BATADV_ATTR_ACTIVE,
226
227 /**
228 * @BATADV_ATTR_TT_ADDRESS: Client MAC address
229 */
230 BATADV_ATTR_TT_ADDRESS,
231
232 /**
233 * @BATADV_ATTR_TT_TTVN: Translation table version
234 */
235 BATADV_ATTR_TT_TTVN,
236
237 /**
238 * @BATADV_ATTR_TT_LAST_TTVN: Previous translation table version
239 */
240 BATADV_ATTR_TT_LAST_TTVN,
241
242 /**
243 * @BATADV_ATTR_TT_CRC32: CRC32 over translation table
244 */
245 BATADV_ATTR_TT_CRC32,
246
247 /**
248 * @BATADV_ATTR_TT_VID: VLAN ID
249 */
250 BATADV_ATTR_TT_VID,
251
252 /**
253 * @BATADV_ATTR_TT_FLAGS: Translation table client flags
254 */
255 BATADV_ATTR_TT_FLAGS,
256
257 /**
258 * @BATADV_ATTR_FLAG_BEST: Flags indicating entry is the best
259 */
260 BATADV_ATTR_FLAG_BEST,
261
262 /**
263 * @BATADV_ATTR_LAST_SEEN_MSECS: Time in milliseconds since last seen
264 */
265 BATADV_ATTR_LAST_SEEN_MSECS,
266
267 /**
268 * @BATADV_ATTR_NEIGH_ADDRESS: Neighbour MAC address
269 */
270 BATADV_ATTR_NEIGH_ADDRESS,
271
272 /**
273 * @BATADV_ATTR_TQ: TQ to neighbour
274 */
275 BATADV_ATTR_TQ,
276
277 /**
278 * @BATADV_ATTR_THROUGHPUT: Estimated throughput to Neighbour
279 */
280 BATADV_ATTR_THROUGHPUT,
281
282 /**
283 * @BATADV_ATTR_BANDWIDTH_UP: Reported uplink bandwidth
284 */
285 BATADV_ATTR_BANDWIDTH_UP,
286
287 /**
288 * @BATADV_ATTR_BANDWIDTH_DOWN: Reported downlink bandwidth
289 */
290 BATADV_ATTR_BANDWIDTH_DOWN,
291
292 /**
293 * @BATADV_ATTR_ROUTER: Gateway router MAC address
294 */
295 BATADV_ATTR_ROUTER,
296
297 /**
298 * @BATADV_ATTR_BLA_OWN: Flag indicating own originator
299 */
300 BATADV_ATTR_BLA_OWN,
301
302 /**
303 * @BATADV_ATTR_BLA_ADDRESS: Bridge loop avoidance claim MAC address
304 */
305 BATADV_ATTR_BLA_ADDRESS,
306
307 /**
308 * @BATADV_ATTR_BLA_VID: BLA VLAN ID
309 */
310 BATADV_ATTR_BLA_VID,
311
312 /**
313 * @BATADV_ATTR_BLA_BACKBONE: BLA gateway originator MAC address
314 */
315 BATADV_ATTR_BLA_BACKBONE,
316
317 /**
318 * @BATADV_ATTR_BLA_CRC: BLA CRC
319 */
320 BATADV_ATTR_BLA_CRC,
321
322 /**
323 * @BATADV_ATTR_DAT_CACHE_IP4ADDRESS: Client IPv4 address
324 */
325 BATADV_ATTR_DAT_CACHE_IP4ADDRESS,
326
327 /**
328 * @BATADV_ATTR_DAT_CACHE_HWADDRESS: Client MAC address
329 */
330 BATADV_ATTR_DAT_CACHE_HWADDRESS,
331
332 /**
333 * @BATADV_ATTR_DAT_CACHE_VID: VLAN ID
334 */
335 BATADV_ATTR_DAT_CACHE_VID,
336
337 /**
338 * @BATADV_ATTR_MCAST_FLAGS: Per originator multicast flags
339 */
340 BATADV_ATTR_MCAST_FLAGS,
341
342 /**
343 * @BATADV_ATTR_MCAST_FLAGS_PRIV: Private, own multicast flags
344 */
345 BATADV_ATTR_MCAST_FLAGS_PRIV,
346
347 /* add attributes above here, update the policy in netlink.c */
348
349 /**
350 * @__BATADV_ATTR_AFTER_LAST: internal use
351 */
352 __BATADV_ATTR_AFTER_LAST,
353
354 /**
355 * @NUM_BATADV_ATTR: total number of batadv_nl_attrs available
356 */
357 NUM_BATADV_ATTR = __BATADV_ATTR_AFTER_LAST,
358
359 /**
360 * @BATADV_ATTR_MAX: highest attribute number currently defined
361 */
362 BATADV_ATTR_MAX = __BATADV_ATTR_AFTER_LAST - 1
363};
364
365/**
366 * enum batadv_nl_commands - supported batman-adv netlink commands
367 */
368enum batadv_nl_commands {
369 /**
370 * @BATADV_CMD_UNSPEC: unspecified command to catch errors
371 */
372 BATADV_CMD_UNSPEC,
373
374 /**
375 * @BATADV_CMD_GET_MESH_INFO: Query basic information about batman-adv
376 * device
377 */
378 BATADV_CMD_GET_MESH_INFO,
379
380 /**
381 * @BATADV_CMD_TP_METER: Start a tp meter session
382 */
383 BATADV_CMD_TP_METER,
384
385 /**
386 * @BATADV_CMD_TP_METER_CANCEL: Cancel a tp meter session
387 */
388 BATADV_CMD_TP_METER_CANCEL,
389
390 /**
391 * @BATADV_CMD_GET_ROUTING_ALGOS: Query the list of routing algorithms.
392 */
393 BATADV_CMD_GET_ROUTING_ALGOS,
394
395 /**
396 * @BATADV_CMD_GET_HARDIFS: Query list of hard interfaces
397 */
398 BATADV_CMD_GET_HARDIFS,
399
400 /**
401 * @BATADV_CMD_GET_TRANSTABLE_LOCAL: Query list of local translations
402 */
403 BATADV_CMD_GET_TRANSTABLE_LOCAL,
404
405 /**
406 * @BATADV_CMD_GET_TRANSTABLE_GLOBAL: Query list of global translations
407 */
408 BATADV_CMD_GET_TRANSTABLE_GLOBAL,
409
410 /**
411 * @BATADV_CMD_GET_ORIGINATORS: Query list of originators
412 */
413 BATADV_CMD_GET_ORIGINATORS,
414
415 /**
416 * @BATADV_CMD_GET_NEIGHBORS: Query list of neighbours
417 */
418 BATADV_CMD_GET_NEIGHBORS,
419
420 /**
421 * @BATADV_CMD_GET_GATEWAYS: Query list of gateways
422 */
423 BATADV_CMD_GET_GATEWAYS,
424
425 /**
426 * @BATADV_CMD_GET_BLA_CLAIM: Query list of bridge loop avoidance claims
427 */
428 BATADV_CMD_GET_BLA_CLAIM,
429
430 /**
431 * @BATADV_CMD_GET_BLA_BACKBONE: Query list of bridge loop avoidance
432 * backbones
433 */
434 BATADV_CMD_GET_BLA_BACKBONE,
435
436 /**
437 * @BATADV_CMD_GET_DAT_CACHE: Query list of DAT cache entries
438 */
439 BATADV_CMD_GET_DAT_CACHE,
440
441 /**
442 * @BATADV_CMD_GET_MCAST_FLAGS: Query list of multicast flags
443 */
444 BATADV_CMD_GET_MCAST_FLAGS,
445
446 /* add new commands above here */
447
448 /**
449 * @__BATADV_CMD_AFTER_LAST: internal use
450 */
451 __BATADV_CMD_AFTER_LAST,
452
453 /**
454 * @BATADV_CMD_MAX: highest used command number
455 */
456 BATADV_CMD_MAX = __BATADV_CMD_AFTER_LAST - 1
457};
458
459/**
460 * enum batadv_tp_meter_reason - reason of a tp meter test run stop
461 */
462enum batadv_tp_meter_reason {
463 /**
464 * @BATADV_TP_REASON_COMPLETE: sender finished tp run
465 */
466 BATADV_TP_REASON_COMPLETE = 3,
467
468 /**
469 * @BATADV_TP_REASON_CANCEL: sender was stopped during run
470 */
471 BATADV_TP_REASON_CANCEL = 4,
472
473 /* error status >= 128 */
474
475 /**
476 * @BATADV_TP_REASON_DST_UNREACHABLE: receiver could not be reached or
477 * didn't answer
478 */
479 BATADV_TP_REASON_DST_UNREACHABLE = 128,
480
481 /**
482 * @BATADV_TP_REASON_RESEND_LIMIT: (unused) sender retry reached limit
483 */
484 BATADV_TP_REASON_RESEND_LIMIT = 129,
485
486 /**
487 * @BATADV_TP_REASON_ALREADY_ONGOING: test to or from the same node
488 * already ongoing
489 */
490 BATADV_TP_REASON_ALREADY_ONGOING = 130,
491
492 /**
493 * @BATADV_TP_REASON_MEMORY_ERROR: test was stopped due to low memory
494 */
495 BATADV_TP_REASON_MEMORY_ERROR = 131,
496
497 /**
498 * @BATADV_TP_REASON_CANT_SEND: failed to send via outgoing interface
499 */
500 BATADV_TP_REASON_CANT_SEND = 132,
501
502 /**
503 * @BATADV_TP_REASON_TOO_MANY: too many ongoing sessions
504 */
505 BATADV_TP_REASON_TOO_MANY = 133,
506};
507
508#endif /* _UAPI_LINUX_BATMAN_ADV_H_ */