1 /* SPDX-License-Identifier: MIT */
2 /* Copyright (C) 2016-2017 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 _UAPI_LINUX_BATMAN_ADV_H_
26 #define _UAPI_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_nl_attrs - batman-adv netlink attributes
97 enum batadv_nl_attrs
{
99 * @BATADV_ATTR_UNSPEC: unspecified attribute to catch errors
104 * @BATADV_ATTR_VERSION: batman-adv version string
109 * @BATADV_ATTR_ALGO_NAME: name of routing algorithm
111 BATADV_ATTR_ALGO_NAME
,
114 * @BATADV_ATTR_MESH_IFINDEX: index of the batman-adv interface
116 BATADV_ATTR_MESH_IFINDEX
,
119 * @BATADV_ATTR_MESH_IFNAME: name of the batman-adv interface
121 BATADV_ATTR_MESH_IFNAME
,
124 * @BATADV_ATTR_MESH_ADDRESS: mac address of the batman-adv interface
126 BATADV_ATTR_MESH_ADDRESS
,
129 * @BATADV_ATTR_HARD_IFINDEX: index of the non-batman-adv interface
131 BATADV_ATTR_HARD_IFINDEX
,
134 * @BATADV_ATTR_HARD_IFNAME: name of the non-batman-adv interface
136 BATADV_ATTR_HARD_IFNAME
,
139 * @BATADV_ATTR_HARD_ADDRESS: mac address of the non-batman-adv
142 BATADV_ATTR_HARD_ADDRESS
,
145 * @BATADV_ATTR_ORIG_ADDRESS: originator mac address
147 BATADV_ATTR_ORIG_ADDRESS
,
150 * @BATADV_ATTR_TPMETER_RESULT: result of run (see
151 * batadv_tp_meter_status)
153 BATADV_ATTR_TPMETER_RESULT
,
156 * @BATADV_ATTR_TPMETER_TEST_TIME: time (msec) the run took
158 BATADV_ATTR_TPMETER_TEST_TIME
,
161 * @BATADV_ATTR_TPMETER_BYTES: amount of acked bytes during run
163 BATADV_ATTR_TPMETER_BYTES
,
166 * @BATADV_ATTR_TPMETER_COOKIE: session cookie to match tp_meter session
168 BATADV_ATTR_TPMETER_COOKIE
,
171 * @BATADV_ATTR_PAD: attribute used for padding for 64-bit alignment
176 * @BATADV_ATTR_ACTIVE: Flag indicating if the hard interface is active
181 * @BATADV_ATTR_TT_ADDRESS: Client MAC address
183 BATADV_ATTR_TT_ADDRESS
,
186 * @BATADV_ATTR_TT_TTVN: Translation table version
191 * @BATADV_ATTR_TT_LAST_TTVN: Previous translation table version
193 BATADV_ATTR_TT_LAST_TTVN
,
196 * @BATADV_ATTR_TT_CRC32: CRC32 over translation table
198 BATADV_ATTR_TT_CRC32
,
201 * @BATADV_ATTR_TT_VID: VLAN ID
206 * @BATADV_ATTR_TT_FLAGS: Translation table client flags
208 BATADV_ATTR_TT_FLAGS
,
211 * @BATADV_ATTR_FLAG_BEST: Flags indicating entry is the best
213 BATADV_ATTR_FLAG_BEST
,
216 * @BATADV_ATTR_LAST_SEEN_MSECS: Time in milliseconds since last seen
218 BATADV_ATTR_LAST_SEEN_MSECS
,
221 * @BATADV_ATTR_NEIGH_ADDRESS: Neighbour MAC address
223 BATADV_ATTR_NEIGH_ADDRESS
,
226 * @BATADV_ATTR_TQ: TQ to neighbour
231 * @BATADV_ATTR_THROUGHPUT: Estimated throughput to Neighbour
233 BATADV_ATTR_THROUGHPUT
,
236 * @BATADV_ATTR_BANDWIDTH_UP: Reported uplink bandwidth
238 BATADV_ATTR_BANDWIDTH_UP
,
241 * @BATADV_ATTR_BANDWIDTH_DOWN: Reported downlink bandwidth
243 BATADV_ATTR_BANDWIDTH_DOWN
,
246 * @BATADV_ATTR_ROUTER: Gateway router MAC address
251 * @BATADV_ATTR_BLA_OWN: Flag indicating own originator
256 * @BATADV_ATTR_BLA_ADDRESS: Bridge loop avoidance claim MAC address
258 BATADV_ATTR_BLA_ADDRESS
,
261 * @BATADV_ATTR_BLA_VID: BLA VLAN ID
266 * @BATADV_ATTR_BLA_BACKBONE: BLA gateway originator MAC address
268 BATADV_ATTR_BLA_BACKBONE
,
271 * @BATADV_ATTR_BLA_CRC: BLA CRC
275 /* add attributes above here, update the policy in netlink.c */
278 * @__BATADV_ATTR_AFTER_LAST: internal use
280 __BATADV_ATTR_AFTER_LAST
,
283 * @NUM_BATADV_ATTR: total number of batadv_nl_attrs available
285 NUM_BATADV_ATTR
= __BATADV_ATTR_AFTER_LAST
,
288 * @BATADV_ATTR_MAX: highest attribute number currently defined
290 BATADV_ATTR_MAX
= __BATADV_ATTR_AFTER_LAST
- 1
294 * enum batadv_nl_commands - supported batman-adv netlink commands
296 enum batadv_nl_commands
{
298 * @BATADV_CMD_UNSPEC: unspecified command to catch errors
303 * @BATADV_CMD_GET_MESH_INFO: Query basic information about batman-adv
306 BATADV_CMD_GET_MESH_INFO
,
309 * @BATADV_CMD_TP_METER: Start a tp meter session
314 * @BATADV_CMD_TP_METER_CANCEL: Cancel a tp meter session
316 BATADV_CMD_TP_METER_CANCEL
,
319 * @BATADV_CMD_GET_ROUTING_ALGOS: Query the list of routing algorithms.
321 BATADV_CMD_GET_ROUTING_ALGOS
,
324 * @BATADV_CMD_GET_HARDIFS: Query list of hard interfaces
326 BATADV_CMD_GET_HARDIFS
,
329 * @BATADV_CMD_GET_TRANSTABLE_LOCAL: Query list of local translations
331 BATADV_CMD_GET_TRANSTABLE_LOCAL
,
334 * @BATADV_CMD_GET_TRANSTABLE_GLOBAL: Query list of global translations
336 BATADV_CMD_GET_TRANSTABLE_GLOBAL
,
339 * @BATADV_CMD_GET_ORIGINATORS: Query list of originators
341 BATADV_CMD_GET_ORIGINATORS
,
344 * @BATADV_CMD_GET_NEIGHBORS: Query list of neighbours
346 BATADV_CMD_GET_NEIGHBORS
,
349 * @BATADV_CMD_GET_GATEWAYS: Query list of gateways
351 BATADV_CMD_GET_GATEWAYS
,
354 * @BATADV_CMD_GET_BLA_CLAIM: Query list of bridge loop avoidance claims
356 BATADV_CMD_GET_BLA_CLAIM
,
359 * @BATADV_CMD_GET_BLA_BACKBONE: Query list of bridge loop avoidance
362 BATADV_CMD_GET_BLA_BACKBONE
,
364 /* add new commands above here */
367 * @__BATADV_CMD_AFTER_LAST: internal use
369 __BATADV_CMD_AFTER_LAST
,
372 * @BATADV_CMD_MAX: highest used command number
374 BATADV_CMD_MAX
= __BATADV_CMD_AFTER_LAST
- 1
378 * enum batadv_tp_meter_reason - reason of a tp meter test run stop
380 enum batadv_tp_meter_reason
{
382 * @BATADV_TP_REASON_COMPLETE: sender finished tp run
384 BATADV_TP_REASON_COMPLETE
= 3,
387 * @BATADV_TP_REASON_CANCEL: sender was stopped during run
389 BATADV_TP_REASON_CANCEL
= 4,
391 /* error status >= 128 */
394 * @BATADV_TP_REASON_DST_UNREACHABLE: receiver could not be reached or
397 BATADV_TP_REASON_DST_UNREACHABLE
= 128,
400 * @BATADV_TP_REASON_RESEND_LIMIT: (unused) sender retry reached limit
402 BATADV_TP_REASON_RESEND_LIMIT
= 129,
405 * @BATADV_TP_REASON_ALREADY_ONGOING: test to or from the same node
408 BATADV_TP_REASON_ALREADY_ONGOING
= 130,
411 * @BATADV_TP_REASON_MEMORY_ERROR: test was stopped due to low memory
413 BATADV_TP_REASON_MEMORY_ERROR
= 131,
416 * @BATADV_TP_REASON_CANT_SEND: failed to send via outgoing interface
418 BATADV_TP_REASON_CANT_SEND
= 132,
421 * @BATADV_TP_REASON_TOO_MANY: too many ongoing sessions
423 BATADV_TP_REASON_TOO_MANY
= 133,
426 #endif /* _UAPI_LINUX_BATMAN_ADV_H_ */