1 /* SPDX-License-Identifier: MIT */
2 /* Copyright (C) 2016-2018 B.A.T.M.A.N. contributors:
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:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
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.
25 #ifndef _LINUX_BATMAN_ADV_H_
26 #define _LINUX_BATMAN_ADV_H_
28 #define BATADV_NL_NAME "batadv"
30 #define BATADV_NL_MCAST_GROUP_TPMETER "tpmeter"
33 * enum batadv_tt_client_flags - TT client specific flags
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
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.
43 enum batadv_tt_client_flags {
45 * @BATADV_TT_CLIENT_DEL: the client has to be deleted from the table
47 BATADV_TT_CLIENT_DEL = (1 << 0),
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
54 BATADV_TT_CLIENT_ROAM = (1 << 1),
57 * @BATADV_TT_CLIENT_WIFI: this client is connected through a wifi
58 * interface. This information is used by the "AP Isolation" feature
60 BATADV_TT_CLIENT_WIFI = (1 << 4),
63 * @BATADV_TT_CLIENT_ISOLA: this client is considered "isolated". This
64 * information is used by the Extended Isolation feature
66 BATADV_TT_CLIENT_ISOLA = (1 << 5),
69 * @BATADV_TT_CLIENT_NOPURGE: this client should never be removed from
72 BATADV_TT_CLIENT_NOPURGE = (1 << 8),
75 * @BATADV_TT_CLIENT_NEW: this client has been added to the local table
76 * but has not been announced yet
78 BATADV_TT_CLIENT_NEW = (1 << 9),
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
85 BATADV_TT_CLIENT_PENDING = (1 << 10),
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
91 BATADV_TT_CLIENT_TEMP = (1 << 11),
95 * enum batadv_mcast_flags_priv - Private, own multicast flags
97 * These are internal, multicast related flags. Currently they describe certain
98 * multicast related attributes of the segment this originator bridges into the
101 * Those attributes are used to determine the public multicast flags this
102 * originator is going to announce via TT.
104 * For netlink, if BATADV_MCAST_FLAGS_BRIDGED is unset then all querier
105 * related flags are undefined.
107 enum batadv_mcast_flags_priv {
109 * @BATADV_MCAST_FLAGS_BRIDGED: There is a bridge on top of the mesh
112 BATADV_MCAST_FLAGS_BRIDGED = (1 << 0),
115 * @BATADV_MCAST_FLAGS_QUERIER_IPV4_EXISTS: Whether an IGMP querier
118 BATADV_MCAST_FLAGS_QUERIER_IPV4_EXISTS = (1 << 1),
121 * @BATADV_MCAST_FLAGS_QUERIER_IPV6_EXISTS: Whether an MLD querier
124 BATADV_MCAST_FLAGS_QUERIER_IPV6_EXISTS = (1 << 2),
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)
131 BATADV_MCAST_FLAGS_QUERIER_IPV4_SHADOWING = (1 << 3),
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)
138 BATADV_MCAST_FLAGS_QUERIER_IPV6_SHADOWING = (1 << 4),
142 * enum batadv_nl_attrs - batman-adv netlink attributes
144 enum batadv_nl_attrs {
146 * @BATADV_ATTR_UNSPEC: unspecified attribute to catch errors
151 * @BATADV_ATTR_VERSION: batman-adv version string
156 * @BATADV_ATTR_ALGO_NAME: name of routing algorithm
158 BATADV_ATTR_ALGO_NAME,
161 * @BATADV_ATTR_MESH_IFINDEX: index of the batman-adv interface
163 BATADV_ATTR_MESH_IFINDEX,
166 * @BATADV_ATTR_MESH_IFNAME: name of the batman-adv interface
168 BATADV_ATTR_MESH_IFNAME,
171 * @BATADV_ATTR_MESH_ADDRESS: mac address of the batman-adv interface
173 BATADV_ATTR_MESH_ADDRESS,
176 * @BATADV_ATTR_HARD_IFINDEX: index of the non-batman-adv interface
178 BATADV_ATTR_HARD_IFINDEX,
181 * @BATADV_ATTR_HARD_IFNAME: name of the non-batman-adv interface
183 BATADV_ATTR_HARD_IFNAME,
186 * @BATADV_ATTR_HARD_ADDRESS: mac address of the non-batman-adv
189 BATADV_ATTR_HARD_ADDRESS,
192 * @BATADV_ATTR_ORIG_ADDRESS: originator mac address
194 BATADV_ATTR_ORIG_ADDRESS,
197 * @BATADV_ATTR_TPMETER_RESULT: result of run (see
198 * batadv_tp_meter_status)
200 BATADV_ATTR_TPMETER_RESULT,
203 * @BATADV_ATTR_TPMETER_TEST_TIME: time (msec) the run took
205 BATADV_ATTR_TPMETER_TEST_TIME,
208 * @BATADV_ATTR_TPMETER_BYTES: amount of acked bytes during run
210 BATADV_ATTR_TPMETER_BYTES,
213 * @BATADV_ATTR_TPMETER_COOKIE: session cookie to match tp_meter session
215 BATADV_ATTR_TPMETER_COOKIE,
218 * @BATADV_ATTR_PAD: attribute used for padding for 64-bit alignment
223 * @BATADV_ATTR_ACTIVE: Flag indicating if the hard interface is active
228 * @BATADV_ATTR_TT_ADDRESS: Client MAC address
230 BATADV_ATTR_TT_ADDRESS,
233 * @BATADV_ATTR_TT_TTVN: Translation table version
238 * @BATADV_ATTR_TT_LAST_TTVN: Previous translation table version
240 BATADV_ATTR_TT_LAST_TTVN,
243 * @BATADV_ATTR_TT_CRC32: CRC32 over translation table
245 BATADV_ATTR_TT_CRC32,
248 * @BATADV_ATTR_TT_VID: VLAN ID
253 * @BATADV_ATTR_TT_FLAGS: Translation table client flags
255 BATADV_ATTR_TT_FLAGS,
258 * @BATADV_ATTR_FLAG_BEST: Flags indicating entry is the best
260 BATADV_ATTR_FLAG_BEST,
263 * @BATADV_ATTR_LAST_SEEN_MSECS: Time in milliseconds since last seen
265 BATADV_ATTR_LAST_SEEN_MSECS,
268 * @BATADV_ATTR_NEIGH_ADDRESS: Neighbour MAC address
270 BATADV_ATTR_NEIGH_ADDRESS,
273 * @BATADV_ATTR_TQ: TQ to neighbour
278 * @BATADV_ATTR_THROUGHPUT: Estimated throughput to Neighbour
280 BATADV_ATTR_THROUGHPUT,
283 * @BATADV_ATTR_BANDWIDTH_UP: Reported uplink bandwidth
285 BATADV_ATTR_BANDWIDTH_UP,
288 * @BATADV_ATTR_BANDWIDTH_DOWN: Reported downlink bandwidth
290 BATADV_ATTR_BANDWIDTH_DOWN,
293 * @BATADV_ATTR_ROUTER: Gateway router MAC address
298 * @BATADV_ATTR_BLA_OWN: Flag indicating own originator
303 * @BATADV_ATTR_BLA_ADDRESS: Bridge loop avoidance claim MAC address
305 BATADV_ATTR_BLA_ADDRESS,
308 * @BATADV_ATTR_BLA_VID: BLA VLAN ID
313 * @BATADV_ATTR_BLA_BACKBONE: BLA gateway originator MAC address
315 BATADV_ATTR_BLA_BACKBONE,
318 * @BATADV_ATTR_BLA_CRC: BLA CRC
323 * @BATADV_ATTR_DAT_CACHE_IP4ADDRESS: Client IPv4 address
325 BATADV_ATTR_DAT_CACHE_IP4ADDRESS,
328 * @BATADV_ATTR_DAT_CACHE_HWADDRESS: Client MAC address
330 BATADV_ATTR_DAT_CACHE_HWADDRESS,
333 * @BATADV_ATTR_DAT_CACHE_VID: VLAN ID
335 BATADV_ATTR_DAT_CACHE_VID,
338 * @BATADV_ATTR_MCAST_FLAGS: Per originator multicast flags
340 BATADV_ATTR_MCAST_FLAGS,
343 * @BATADV_ATTR_MCAST_FLAGS_PRIV: Private, own multicast flags
345 BATADV_ATTR_MCAST_FLAGS_PRIV,
347 /* add attributes above here, update the policy in netlink.c */
350 * @__BATADV_ATTR_AFTER_LAST: internal use
352 __BATADV_ATTR_AFTER_LAST,
355 * @NUM_BATADV_ATTR: total number of batadv_nl_attrs available
357 NUM_BATADV_ATTR = __BATADV_ATTR_AFTER_LAST,
360 * @BATADV_ATTR_MAX: highest attribute number currently defined
362 BATADV_ATTR_MAX = __BATADV_ATTR_AFTER_LAST - 1
366 * enum batadv_nl_commands - supported batman-adv netlink commands
368 enum batadv_nl_commands {
370 * @BATADV_CMD_UNSPEC: unspecified command to catch errors
375 * @BATADV_CMD_GET_MESH_INFO: Query basic information about batman-adv
378 BATADV_CMD_GET_MESH_INFO,
381 * @BATADV_CMD_TP_METER: Start a tp meter session
386 * @BATADV_CMD_TP_METER_CANCEL: Cancel a tp meter session
388 BATADV_CMD_TP_METER_CANCEL,
391 * @BATADV_CMD_GET_ROUTING_ALGOS: Query the list of routing algorithms.
393 BATADV_CMD_GET_ROUTING_ALGOS,
396 * @BATADV_CMD_GET_HARDIFS: Query list of hard interfaces
398 BATADV_CMD_GET_HARDIFS,
401 * @BATADV_CMD_GET_TRANSTABLE_LOCAL: Query list of local translations
403 BATADV_CMD_GET_TRANSTABLE_LOCAL,
406 * @BATADV_CMD_GET_TRANSTABLE_GLOBAL: Query list of global translations
408 BATADV_CMD_GET_TRANSTABLE_GLOBAL,
411 * @BATADV_CMD_GET_ORIGINATORS: Query list of originators
413 BATADV_CMD_GET_ORIGINATORS,
416 * @BATADV_CMD_GET_NEIGHBORS: Query list of neighbours
418 BATADV_CMD_GET_NEIGHBORS,
421 * @BATADV_CMD_GET_GATEWAYS: Query list of gateways
423 BATADV_CMD_GET_GATEWAYS,
426 * @BATADV_CMD_GET_BLA_CLAIM: Query list of bridge loop avoidance claims
428 BATADV_CMD_GET_BLA_CLAIM,
431 * @BATADV_CMD_GET_BLA_BACKBONE: Query list of bridge loop avoidance
434 BATADV_CMD_GET_BLA_BACKBONE,
437 * @BATADV_CMD_GET_DAT_CACHE: Query list of DAT cache entries
439 BATADV_CMD_GET_DAT_CACHE,
442 * @BATADV_CMD_GET_MCAST_FLAGS: Query list of multicast flags
444 BATADV_CMD_GET_MCAST_FLAGS,
446 /* add new commands above here */
449 * @__BATADV_CMD_AFTER_LAST: internal use
451 __BATADV_CMD_AFTER_LAST,
454 * @BATADV_CMD_MAX: highest used command number
456 BATADV_CMD_MAX = __BATADV_CMD_AFTER_LAST - 1
460 * enum batadv_tp_meter_reason - reason of a tp meter test run stop
462 enum batadv_tp_meter_reason {
464 * @BATADV_TP_REASON_COMPLETE: sender finished tp run
466 BATADV_TP_REASON_COMPLETE = 3,
469 * @BATADV_TP_REASON_CANCEL: sender was stopped during run
471 BATADV_TP_REASON_CANCEL = 4,
473 /* error status >= 128 */
476 * @BATADV_TP_REASON_DST_UNREACHABLE: receiver could not be reached or
479 BATADV_TP_REASON_DST_UNREACHABLE = 128,
482 * @BATADV_TP_REASON_RESEND_LIMIT: (unused) sender retry reached limit
484 BATADV_TP_REASON_RESEND_LIMIT = 129,
487 * @BATADV_TP_REASON_ALREADY_ONGOING: test to or from the same node
490 BATADV_TP_REASON_ALREADY_ONGOING = 130,
493 * @BATADV_TP_REASON_MEMORY_ERROR: test was stopped due to low memory
495 BATADV_TP_REASON_MEMORY_ERROR = 131,
498 * @BATADV_TP_REASON_CANT_SEND: failed to send via outgoing interface
500 BATADV_TP_REASON_CANT_SEND = 132,
503 * @BATADV_TP_REASON_TOO_MANY: too many ongoing sessions
505 BATADV_TP_REASON_TOO_MANY = 133,
508 #endif /* _LINUX_BATMAN_ADV_H_ */