1 /* SPDX-License-Identifier: MIT */
2 /* Copyright (C) B.A.T.M.A.N. contributors:
7 #ifndef _UAPI_LINUX_BATMAN_ADV_H_
8 #define _UAPI_LINUX_BATMAN_ADV_H_
10 #define BATADV_NL_NAME "batadv"
12 #define BATADV_NL_MCAST_GROUP_CONFIG "config"
13 #define BATADV_NL_MCAST_GROUP_TPMETER "tpmeter"
16 * enum batadv_tt_client_flags - TT client specific flags
18 * Bits from 0 to 7 are called _remote flags_ because they are sent on the wire.
19 * Bits from 8 to 15 are called _local flags_ because they are used for local
22 * Bits from 4 to 7 - a subset of remote flags - are ensured to be in sync with
23 * the other nodes in the network. To achieve this goal these flags are included
24 * in the TT CRC computation.
26 enum batadv_tt_client_flags {
28 * @BATADV_TT_CLIENT_DEL: the client has to be deleted from the table
30 BATADV_TT_CLIENT_DEL = (1 << 0),
33 * @BATADV_TT_CLIENT_ROAM: the client roamed to/from another node and
34 * the new update telling its new real location has not been
37 BATADV_TT_CLIENT_ROAM = (1 << 1),
40 * @BATADV_TT_CLIENT_WIFI: this client is connected through a wifi
41 * interface. This information is used by the "AP Isolation" feature
43 BATADV_TT_CLIENT_WIFI = (1 << 4),
46 * @BATADV_TT_CLIENT_ISOLA: this client is considered "isolated". This
47 * information is used by the Extended Isolation feature
49 BATADV_TT_CLIENT_ISOLA = (1 << 5),
52 * @BATADV_TT_CLIENT_NOPURGE: this client should never be removed from
55 BATADV_TT_CLIENT_NOPURGE = (1 << 8),
58 * @BATADV_TT_CLIENT_NEW: this client has been added to the local table
59 * but has not been announced yet
61 BATADV_TT_CLIENT_NEW = (1 << 9),
64 * @BATADV_TT_CLIENT_PENDING: this client is marked for removal but it
65 * is kept in the table for one more originator interval for consistency
68 BATADV_TT_CLIENT_PENDING = (1 << 10),
71 * @BATADV_TT_CLIENT_TEMP: this global client has been detected to be
72 * part of the network but no node has already announced it
74 BATADV_TT_CLIENT_TEMP = (1 << 11),
78 * enum batadv_mcast_flags_priv - Private, own multicast flags
80 * These are internal, multicast related flags. Currently they describe certain
81 * multicast related attributes of the segment this originator bridges into the
84 * Those attributes are used to determine the public multicast flags this
85 * originator is going to announce via TT.
87 * For netlink, if BATADV_MCAST_FLAGS_BRIDGED is unset then all querier
88 * related flags are undefined.
90 enum batadv_mcast_flags_priv {
92 * @BATADV_MCAST_FLAGS_BRIDGED: There is a bridge on top of the mesh
95 BATADV_MCAST_FLAGS_BRIDGED = (1 << 0),
98 * @BATADV_MCAST_FLAGS_QUERIER_IPV4_EXISTS: Whether an IGMP querier
101 BATADV_MCAST_FLAGS_QUERIER_IPV4_EXISTS = (1 << 1),
104 * @BATADV_MCAST_FLAGS_QUERIER_IPV6_EXISTS: Whether an MLD querier
107 BATADV_MCAST_FLAGS_QUERIER_IPV6_EXISTS = (1 << 2),
110 * @BATADV_MCAST_FLAGS_QUERIER_IPV4_SHADOWING: If an IGMP querier
111 * exists, whether it is potentially shadowing multicast listeners
112 * (i.e. querier is behind our own bridge segment)
114 BATADV_MCAST_FLAGS_QUERIER_IPV4_SHADOWING = (1 << 3),
117 * @BATADV_MCAST_FLAGS_QUERIER_IPV6_SHADOWING: If an MLD querier
118 * exists, whether it is potentially shadowing multicast listeners
119 * (i.e. querier is behind our own bridge segment)
121 BATADV_MCAST_FLAGS_QUERIER_IPV6_SHADOWING = (1 << 4),
125 * enum batadv_gw_modes - gateway mode of node
127 enum batadv_gw_modes {
128 /** @BATADV_GW_MODE_OFF: gw mode disabled */
131 /** @BATADV_GW_MODE_CLIENT: send DHCP requests to gw servers */
132 BATADV_GW_MODE_CLIENT,
134 /** @BATADV_GW_MODE_SERVER: announce itself as gateway server */
135 BATADV_GW_MODE_SERVER,
139 * enum batadv_nl_attrs - batman-adv netlink attributes
141 enum batadv_nl_attrs {
143 * @BATADV_ATTR_UNSPEC: unspecified attribute to catch errors
148 * @BATADV_ATTR_VERSION: batman-adv version string
153 * @BATADV_ATTR_ALGO_NAME: name of routing algorithm
155 BATADV_ATTR_ALGO_NAME,
158 * @BATADV_ATTR_MESH_IFINDEX: index of the batman-adv interface
160 BATADV_ATTR_MESH_IFINDEX,
163 * @BATADV_ATTR_MESH_IFNAME: name of the batman-adv interface
165 BATADV_ATTR_MESH_IFNAME,
168 * @BATADV_ATTR_MESH_ADDRESS: mac address of the batman-adv interface
170 BATADV_ATTR_MESH_ADDRESS,
173 * @BATADV_ATTR_HARD_IFINDEX: index of the non-batman-adv interface
175 BATADV_ATTR_HARD_IFINDEX,
178 * @BATADV_ATTR_HARD_IFNAME: name of the non-batman-adv interface
180 BATADV_ATTR_HARD_IFNAME,
183 * @BATADV_ATTR_HARD_ADDRESS: mac address of the non-batman-adv
186 BATADV_ATTR_HARD_ADDRESS,
189 * @BATADV_ATTR_ORIG_ADDRESS: originator mac address
191 BATADV_ATTR_ORIG_ADDRESS,
194 * @BATADV_ATTR_TPMETER_RESULT: result of run (see
195 * batadv_tp_meter_status)
197 BATADV_ATTR_TPMETER_RESULT,
200 * @BATADV_ATTR_TPMETER_TEST_TIME: time (msec) the run took
202 BATADV_ATTR_TPMETER_TEST_TIME,
205 * @BATADV_ATTR_TPMETER_BYTES: amount of acked bytes during run
207 BATADV_ATTR_TPMETER_BYTES,
210 * @BATADV_ATTR_TPMETER_COOKIE: session cookie to match tp_meter session
212 BATADV_ATTR_TPMETER_COOKIE,
215 * @BATADV_ATTR_PAD: attribute used for padding for 64-bit alignment
220 * @BATADV_ATTR_ACTIVE: Flag indicating if the hard interface is active
225 * @BATADV_ATTR_TT_ADDRESS: Client MAC address
227 BATADV_ATTR_TT_ADDRESS,
230 * @BATADV_ATTR_TT_TTVN: Translation table version
235 * @BATADV_ATTR_TT_LAST_TTVN: Previous translation table version
237 BATADV_ATTR_TT_LAST_TTVN,
240 * @BATADV_ATTR_TT_CRC32: CRC32 over translation table
242 BATADV_ATTR_TT_CRC32,
245 * @BATADV_ATTR_TT_VID: VLAN ID
250 * @BATADV_ATTR_TT_FLAGS: Translation table client flags
252 BATADV_ATTR_TT_FLAGS,
255 * @BATADV_ATTR_FLAG_BEST: Flags indicating entry is the best
257 BATADV_ATTR_FLAG_BEST,
260 * @BATADV_ATTR_LAST_SEEN_MSECS: Time in milliseconds since last seen
262 BATADV_ATTR_LAST_SEEN_MSECS,
265 * @BATADV_ATTR_NEIGH_ADDRESS: Neighbour MAC address
267 BATADV_ATTR_NEIGH_ADDRESS,
270 * @BATADV_ATTR_TQ: TQ to neighbour
275 * @BATADV_ATTR_THROUGHPUT: Estimated throughput to Neighbour
277 BATADV_ATTR_THROUGHPUT,
280 * @BATADV_ATTR_BANDWIDTH_UP: Reported uplink bandwidth
282 BATADV_ATTR_BANDWIDTH_UP,
285 * @BATADV_ATTR_BANDWIDTH_DOWN: Reported downlink bandwidth
287 BATADV_ATTR_BANDWIDTH_DOWN,
290 * @BATADV_ATTR_ROUTER: Gateway router MAC address
295 * @BATADV_ATTR_BLA_OWN: Flag indicating own originator
300 * @BATADV_ATTR_BLA_ADDRESS: Bridge loop avoidance claim MAC address
302 BATADV_ATTR_BLA_ADDRESS,
305 * @BATADV_ATTR_BLA_VID: BLA VLAN ID
310 * @BATADV_ATTR_BLA_BACKBONE: BLA gateway originator MAC address
312 BATADV_ATTR_BLA_BACKBONE,
315 * @BATADV_ATTR_BLA_CRC: BLA CRC
320 * @BATADV_ATTR_DAT_CACHE_IP4ADDRESS: Client IPv4 address
322 BATADV_ATTR_DAT_CACHE_IP4ADDRESS,
325 * @BATADV_ATTR_DAT_CACHE_HWADDRESS: Client MAC address
327 BATADV_ATTR_DAT_CACHE_HWADDRESS,
330 * @BATADV_ATTR_DAT_CACHE_VID: VLAN ID
332 BATADV_ATTR_DAT_CACHE_VID,
335 * @BATADV_ATTR_MCAST_FLAGS: Per originator multicast flags
337 BATADV_ATTR_MCAST_FLAGS,
340 * @BATADV_ATTR_MCAST_FLAGS_PRIV: Private, own multicast flags
342 BATADV_ATTR_MCAST_FLAGS_PRIV,
345 * @BATADV_ATTR_VLANID: VLAN id on top of soft interface
350 * @BATADV_ATTR_AGGREGATED_OGMS_ENABLED: whether the batman protocol
351 * messages of the mesh interface shall be aggregated or not.
353 BATADV_ATTR_AGGREGATED_OGMS_ENABLED,
356 * @BATADV_ATTR_AP_ISOLATION_ENABLED: whether the data traffic going
357 * from a wireless client to another wireless client will be silently
360 BATADV_ATTR_AP_ISOLATION_ENABLED,
363 * @BATADV_ATTR_ISOLATION_MARK: the isolation mark which is used to
364 * classify clients as "isolated" by the Extended Isolation feature.
366 BATADV_ATTR_ISOLATION_MARK,
369 * @BATADV_ATTR_ISOLATION_MASK: the isolation (bit)mask which is used to
370 * classify clients as "isolated" by the Extended Isolation feature.
372 BATADV_ATTR_ISOLATION_MASK,
375 * @BATADV_ATTR_BONDING_ENABLED: whether the data traffic going through
376 * the mesh will be sent using multiple interfaces at the same time.
378 BATADV_ATTR_BONDING_ENABLED,
381 * @BATADV_ATTR_BRIDGE_LOOP_AVOIDANCE_ENABLED: whether the bridge loop
382 * avoidance feature is enabled. This feature detects and avoids loops
383 * between the mesh and devices bridged with the soft interface
385 BATADV_ATTR_BRIDGE_LOOP_AVOIDANCE_ENABLED,
388 * @BATADV_ATTR_DISTRIBUTED_ARP_TABLE_ENABLED: whether the distributed
389 * arp table feature is enabled. This feature uses a distributed hash
390 * table to answer ARP requests without flooding the request through
393 BATADV_ATTR_DISTRIBUTED_ARP_TABLE_ENABLED,
396 * @BATADV_ATTR_FRAGMENTATION_ENABLED: whether the data traffic going
397 * through the mesh will be fragmented or silently discarded if the
398 * packet size exceeds the outgoing interface MTU.
400 BATADV_ATTR_FRAGMENTATION_ENABLED,
403 * @BATADV_ATTR_GW_BANDWIDTH_DOWN: defines the download bandwidth which
404 * is propagated by this node if %BATADV_ATTR_GW_BANDWIDTH_MODE was set
407 BATADV_ATTR_GW_BANDWIDTH_DOWN,
410 * @BATADV_ATTR_GW_BANDWIDTH_UP: defines the upload bandwidth which
411 * is propagated by this node if %BATADV_ATTR_GW_BANDWIDTH_MODE was set
414 BATADV_ATTR_GW_BANDWIDTH_UP,
417 * @BATADV_ATTR_GW_MODE: defines the state of the gateway features.
418 * Possible values are specified in enum batadv_gw_modes
423 * @BATADV_ATTR_GW_SEL_CLASS: defines the selection criteria this node
424 * will use to choose a gateway if gw_mode was set to 'client'.
426 BATADV_ATTR_GW_SEL_CLASS,
429 * @BATADV_ATTR_HOP_PENALTY: defines the penalty which will be applied
430 * to an originator message's tq-field on every hop and/or per
433 BATADV_ATTR_HOP_PENALTY,
436 * @BATADV_ATTR_LOG_LEVEL: bitmask with to define which debug messages
437 * should be send to the debug log/trace ring buffer
439 BATADV_ATTR_LOG_LEVEL,
442 * @BATADV_ATTR_MULTICAST_FORCEFLOOD_ENABLED: whether multicast
443 * optimizations should be replaced by simple broadcast-like flooding
444 * of multicast packets. If set to non-zero then all nodes in the mesh
445 * are going to use classic flooding for any multicast packet with no
448 BATADV_ATTR_MULTICAST_FORCEFLOOD_ENABLED,
451 * @BATADV_ATTR_NETWORK_CODING_ENABLED: whether Network Coding (using
452 * some magic to send fewer wifi packets but still the same content) is
455 BATADV_ATTR_NETWORK_CODING_ENABLED,
458 * @BATADV_ATTR_ORIG_INTERVAL: defines the interval in milliseconds in
459 * which batman sends its protocol messages.
461 BATADV_ATTR_ORIG_INTERVAL,
464 * @BATADV_ATTR_ELP_INTERVAL: defines the interval in milliseconds in
465 * which batman emits probing packets for neighbor sensing (ELP).
467 BATADV_ATTR_ELP_INTERVAL,
470 * @BATADV_ATTR_THROUGHPUT_OVERRIDE: defines the throughput value to be
471 * used by B.A.T.M.A.N. V when estimating the link throughput using
472 * this interface. If the value is set to 0 then batman-adv will try to
473 * estimate the throughput by itself.
475 BATADV_ATTR_THROUGHPUT_OVERRIDE,
478 * @BATADV_ATTR_MULTICAST_FANOUT: defines the maximum number of packet
479 * copies that may be generated for a multicast-to-unicast conversion.
480 * Once this limit is exceeded distribution will fall back to broadcast.
482 BATADV_ATTR_MULTICAST_FANOUT,
484 /* add attributes above here, update the policy in netlink.c */
487 * @__BATADV_ATTR_AFTER_LAST: internal use
489 __BATADV_ATTR_AFTER_LAST,
492 * @NUM_BATADV_ATTR: total number of batadv_nl_attrs available
494 NUM_BATADV_ATTR = __BATADV_ATTR_AFTER_LAST,
497 * @BATADV_ATTR_MAX: highest attribute number currently defined
499 BATADV_ATTR_MAX = __BATADV_ATTR_AFTER_LAST - 1
503 * enum batadv_nl_commands - supported batman-adv netlink commands
505 enum batadv_nl_commands {
507 * @BATADV_CMD_UNSPEC: unspecified command to catch errors
512 * @BATADV_CMD_GET_MESH: Get attributes from softif/mesh
517 * @BATADV_CMD_GET_MESH_INFO: Alias for @BATADV_CMD_GET_MESH
519 BATADV_CMD_GET_MESH_INFO = BATADV_CMD_GET_MESH,
522 * @BATADV_CMD_TP_METER: Start a tp meter session
527 * @BATADV_CMD_TP_METER_CANCEL: Cancel a tp meter session
529 BATADV_CMD_TP_METER_CANCEL,
532 * @BATADV_CMD_GET_ROUTING_ALGOS: Query the list of routing algorithms.
534 BATADV_CMD_GET_ROUTING_ALGOS,
537 * @BATADV_CMD_GET_HARDIF: Get attributes from a hardif of the
540 BATADV_CMD_GET_HARDIF,
543 * @BATADV_CMD_GET_HARDIFS: Alias for @BATADV_CMD_GET_HARDIF
545 BATADV_CMD_GET_HARDIFS = BATADV_CMD_GET_HARDIF,
548 * @BATADV_CMD_GET_TRANSTABLE_LOCAL: Query list of local translations
550 BATADV_CMD_GET_TRANSTABLE_LOCAL,
553 * @BATADV_CMD_GET_TRANSTABLE_GLOBAL: Query list of global translations
555 BATADV_CMD_GET_TRANSTABLE_GLOBAL,
558 * @BATADV_CMD_GET_ORIGINATORS: Query list of originators
560 BATADV_CMD_GET_ORIGINATORS,
563 * @BATADV_CMD_GET_NEIGHBORS: Query list of neighbours
565 BATADV_CMD_GET_NEIGHBORS,
568 * @BATADV_CMD_GET_GATEWAYS: Query list of gateways
570 BATADV_CMD_GET_GATEWAYS,
573 * @BATADV_CMD_GET_BLA_CLAIM: Query list of bridge loop avoidance claims
575 BATADV_CMD_GET_BLA_CLAIM,
578 * @BATADV_CMD_GET_BLA_BACKBONE: Query list of bridge loop avoidance
581 BATADV_CMD_GET_BLA_BACKBONE,
584 * @BATADV_CMD_GET_DAT_CACHE: Query list of DAT cache entries
586 BATADV_CMD_GET_DAT_CACHE,
589 * @BATADV_CMD_GET_MCAST_FLAGS: Query list of multicast flags
591 BATADV_CMD_GET_MCAST_FLAGS,
594 * @BATADV_CMD_SET_MESH: Set attributes for softif/mesh
599 * @BATADV_CMD_SET_HARDIF: Set attributes for hardif of the
602 BATADV_CMD_SET_HARDIF,
605 * @BATADV_CMD_GET_VLAN: Get attributes from a VLAN of the
611 * @BATADV_CMD_SET_VLAN: Set attributes for VLAN of the
616 /* add new commands above here */
619 * @__BATADV_CMD_AFTER_LAST: internal use
621 __BATADV_CMD_AFTER_LAST,
624 * @BATADV_CMD_MAX: highest used command number
626 BATADV_CMD_MAX = __BATADV_CMD_AFTER_LAST - 1
630 * enum batadv_tp_meter_reason - reason of a tp meter test run stop
632 enum batadv_tp_meter_reason {
634 * @BATADV_TP_REASON_COMPLETE: sender finished tp run
636 BATADV_TP_REASON_COMPLETE = 3,
639 * @BATADV_TP_REASON_CANCEL: sender was stopped during run
641 BATADV_TP_REASON_CANCEL = 4,
643 /* error status >= 128 */
646 * @BATADV_TP_REASON_DST_UNREACHABLE: receiver could not be reached or
649 BATADV_TP_REASON_DST_UNREACHABLE = 128,
652 * @BATADV_TP_REASON_RESEND_LIMIT: (unused) sender retry reached limit
654 BATADV_TP_REASON_RESEND_LIMIT = 129,
657 * @BATADV_TP_REASON_ALREADY_ONGOING: test to or from the same node
660 BATADV_TP_REASON_ALREADY_ONGOING = 130,
663 * @BATADV_TP_REASON_MEMORY_ERROR: test was stopped due to low memory
665 BATADV_TP_REASON_MEMORY_ERROR = 131,
668 * @BATADV_TP_REASON_CANT_SEND: failed to send via outgoing interface
670 BATADV_TP_REASON_CANT_SEND = 132,
673 * @BATADV_TP_REASON_TOO_MANY: too many ongoing sessions
675 BATADV_TP_REASON_TOO_MANY = 133,
679 * enum batadv_ifla_attrs - batman-adv ifla nested attributes
681 enum batadv_ifla_attrs {
683 * @IFLA_BATADV_UNSPEC: unspecified attribute which is not parsed by
689 * @IFLA_BATADV_ALGO_NAME: routing algorithm (name) which should be
690 * used by the newly registered batadv net_device.
692 IFLA_BATADV_ALGO_NAME,
694 /* add attributes above here, update the policy in soft-interface.c */
697 * @__IFLA_BATADV_MAX: internal use
702 #define IFLA_BATADV_MAX (__IFLA_BATADV_MAX - 1)
704 #endif /* _UAPI_LINUX_BATMAN_ADV_H_ */