705 lines · c
1/* SPDX-License-Identifier: MIT */2/* Copyright (C) B.A.T.M.A.N. contributors:3 *4 * Matthias Schiffer5 */6 7#ifndef _UAPI_LINUX_BATMAN_ADV_H_8#define _UAPI_LINUX_BATMAN_ADV_H_9 10#define BATADV_NL_NAME "batadv"11 12#define BATADV_NL_MCAST_GROUP_CONFIG "config"13#define BATADV_NL_MCAST_GROUP_TPMETER "tpmeter"14 15/**16 * enum batadv_tt_client_flags - TT client specific flags17 *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 local20 * computations only.21 *22 * Bits from 4 to 7 - a subset of remote flags - are ensured to be in sync with23 * the other nodes in the network. To achieve this goal these flags are included24 * in the TT CRC computation.25 */26enum batadv_tt_client_flags {27 /**28 * @BATADV_TT_CLIENT_DEL: the client has to be deleted from the table29 */30 BATADV_TT_CLIENT_DEL = (1 << 0),31 32 /**33 * @BATADV_TT_CLIENT_ROAM: the client roamed to/from another node and34 * the new update telling its new real location has not been35 * received/sent yet36 */37 BATADV_TT_CLIENT_ROAM = (1 << 1),38 39 /**40 * @BATADV_TT_CLIENT_WIFI: this client is connected through a wifi41 * interface. This information is used by the "AP Isolation" feature42 */43 BATADV_TT_CLIENT_WIFI = (1 << 4),44 45 /**46 * @BATADV_TT_CLIENT_ISOLA: this client is considered "isolated". This47 * information is used by the Extended Isolation feature48 */49 BATADV_TT_CLIENT_ISOLA = (1 << 5),50 51 /**52 * @BATADV_TT_CLIENT_NOPURGE: this client should never be removed from53 * the table54 */55 BATADV_TT_CLIENT_NOPURGE = (1 << 8),56 57 /**58 * @BATADV_TT_CLIENT_NEW: this client has been added to the local table59 * but has not been announced yet60 */61 BATADV_TT_CLIENT_NEW = (1 << 9),62 63 /**64 * @BATADV_TT_CLIENT_PENDING: this client is marked for removal but it65 * is kept in the table for one more originator interval for consistency66 * purposes67 */68 BATADV_TT_CLIENT_PENDING = (1 << 10),69 70 /**71 * @BATADV_TT_CLIENT_TEMP: this global client has been detected to be72 * part of the network but no node has already announced it73 */74 BATADV_TT_CLIENT_TEMP = (1 << 11),75};76 77/**78 * enum batadv_mcast_flags_priv - Private, own multicast flags79 *80 * These are internal, multicast related flags. Currently they describe certain81 * multicast related attributes of the segment this originator bridges into the82 * mesh.83 *84 * Those attributes are used to determine the public multicast flags this85 * originator is going to announce via TT.86 *87 * For netlink, if BATADV_MCAST_FLAGS_BRIDGED is unset then all querier88 * related flags are undefined.89 */90enum batadv_mcast_flags_priv {91 /**92 * @BATADV_MCAST_FLAGS_BRIDGED: There is a bridge on top of the mesh93 * interface.94 */95 BATADV_MCAST_FLAGS_BRIDGED = (1 << 0),96 97 /**98 * @BATADV_MCAST_FLAGS_QUERIER_IPV4_EXISTS: Whether an IGMP querier99 * exists in the mesh100 */101 BATADV_MCAST_FLAGS_QUERIER_IPV4_EXISTS = (1 << 1),102 103 /**104 * @BATADV_MCAST_FLAGS_QUERIER_IPV6_EXISTS: Whether an MLD querier105 * exists in the mesh106 */107 BATADV_MCAST_FLAGS_QUERIER_IPV6_EXISTS = (1 << 2),108 109 /**110 * @BATADV_MCAST_FLAGS_QUERIER_IPV4_SHADOWING: If an IGMP querier111 * exists, whether it is potentially shadowing multicast listeners112 * (i.e. querier is behind our own bridge segment)113 */114 BATADV_MCAST_FLAGS_QUERIER_IPV4_SHADOWING = (1 << 3),115 116 /**117 * @BATADV_MCAST_FLAGS_QUERIER_IPV6_SHADOWING: If an MLD querier118 * exists, whether it is potentially shadowing multicast listeners119 * (i.e. querier is behind our own bridge segment)120 */121 BATADV_MCAST_FLAGS_QUERIER_IPV6_SHADOWING = (1 << 4),122};123 124/**125 * enum batadv_gw_modes - gateway mode of node126 */127enum batadv_gw_modes {128 /** @BATADV_GW_MODE_OFF: gw mode disabled */129 BATADV_GW_MODE_OFF,130 131 /** @BATADV_GW_MODE_CLIENT: send DHCP requests to gw servers */132 BATADV_GW_MODE_CLIENT,133 134 /** @BATADV_GW_MODE_SERVER: announce itself as gateway server */135 BATADV_GW_MODE_SERVER,136};137 138/**139 * enum batadv_nl_attrs - batman-adv netlink attributes140 */141enum batadv_nl_attrs {142 /**143 * @BATADV_ATTR_UNSPEC: unspecified attribute to catch errors144 */145 BATADV_ATTR_UNSPEC,146 147 /**148 * @BATADV_ATTR_VERSION: batman-adv version string149 */150 BATADV_ATTR_VERSION,151 152 /**153 * @BATADV_ATTR_ALGO_NAME: name of routing algorithm154 */155 BATADV_ATTR_ALGO_NAME,156 157 /**158 * @BATADV_ATTR_MESH_IFINDEX: index of the batman-adv interface159 */160 BATADV_ATTR_MESH_IFINDEX,161 162 /**163 * @BATADV_ATTR_MESH_IFNAME: name of the batman-adv interface164 */165 BATADV_ATTR_MESH_IFNAME,166 167 /**168 * @BATADV_ATTR_MESH_ADDRESS: mac address of the batman-adv interface169 */170 BATADV_ATTR_MESH_ADDRESS,171 172 /**173 * @BATADV_ATTR_HARD_IFINDEX: index of the non-batman-adv interface174 */175 BATADV_ATTR_HARD_IFINDEX,176 177 /**178 * @BATADV_ATTR_HARD_IFNAME: name of the non-batman-adv interface179 */180 BATADV_ATTR_HARD_IFNAME,181 182 /**183 * @BATADV_ATTR_HARD_ADDRESS: mac address of the non-batman-adv184 * interface185 */186 BATADV_ATTR_HARD_ADDRESS,187 188 /**189 * @BATADV_ATTR_ORIG_ADDRESS: originator mac address190 */191 BATADV_ATTR_ORIG_ADDRESS,192 193 /**194 * @BATADV_ATTR_TPMETER_RESULT: result of run (see195 * batadv_tp_meter_status)196 */197 BATADV_ATTR_TPMETER_RESULT,198 199 /**200 * @BATADV_ATTR_TPMETER_TEST_TIME: time (msec) the run took201 */202 BATADV_ATTR_TPMETER_TEST_TIME,203 204 /**205 * @BATADV_ATTR_TPMETER_BYTES: amount of acked bytes during run206 */207 BATADV_ATTR_TPMETER_BYTES,208 209 /**210 * @BATADV_ATTR_TPMETER_COOKIE: session cookie to match tp_meter session211 */212 BATADV_ATTR_TPMETER_COOKIE,213 214 /**215 * @BATADV_ATTR_PAD: attribute used for padding for 64-bit alignment216 */217 BATADV_ATTR_PAD,218 219 /**220 * @BATADV_ATTR_ACTIVE: Flag indicating if the hard interface is active221 */222 BATADV_ATTR_ACTIVE,223 224 /**225 * @BATADV_ATTR_TT_ADDRESS: Client MAC address226 */227 BATADV_ATTR_TT_ADDRESS,228 229 /**230 * @BATADV_ATTR_TT_TTVN: Translation table version231 */232 BATADV_ATTR_TT_TTVN,233 234 /**235 * @BATADV_ATTR_TT_LAST_TTVN: Previous translation table version236 */237 BATADV_ATTR_TT_LAST_TTVN,238 239 /**240 * @BATADV_ATTR_TT_CRC32: CRC32 over translation table241 */242 BATADV_ATTR_TT_CRC32,243 244 /**245 * @BATADV_ATTR_TT_VID: VLAN ID246 */247 BATADV_ATTR_TT_VID,248 249 /**250 * @BATADV_ATTR_TT_FLAGS: Translation table client flags251 */252 BATADV_ATTR_TT_FLAGS,253 254 /**255 * @BATADV_ATTR_FLAG_BEST: Flags indicating entry is the best256 */257 BATADV_ATTR_FLAG_BEST,258 259 /**260 * @BATADV_ATTR_LAST_SEEN_MSECS: Time in milliseconds since last seen261 */262 BATADV_ATTR_LAST_SEEN_MSECS,263 264 /**265 * @BATADV_ATTR_NEIGH_ADDRESS: Neighbour MAC address266 */267 BATADV_ATTR_NEIGH_ADDRESS,268 269 /**270 * @BATADV_ATTR_TQ: TQ to neighbour271 */272 BATADV_ATTR_TQ,273 274 /**275 * @BATADV_ATTR_THROUGHPUT: Estimated throughput to Neighbour276 */277 BATADV_ATTR_THROUGHPUT,278 279 /**280 * @BATADV_ATTR_BANDWIDTH_UP: Reported uplink bandwidth281 */282 BATADV_ATTR_BANDWIDTH_UP,283 284 /**285 * @BATADV_ATTR_BANDWIDTH_DOWN: Reported downlink bandwidth286 */287 BATADV_ATTR_BANDWIDTH_DOWN,288 289 /**290 * @BATADV_ATTR_ROUTER: Gateway router MAC address291 */292 BATADV_ATTR_ROUTER,293 294 /**295 * @BATADV_ATTR_BLA_OWN: Flag indicating own originator296 */297 BATADV_ATTR_BLA_OWN,298 299 /**300 * @BATADV_ATTR_BLA_ADDRESS: Bridge loop avoidance claim MAC address301 */302 BATADV_ATTR_BLA_ADDRESS,303 304 /**305 * @BATADV_ATTR_BLA_VID: BLA VLAN ID306 */307 BATADV_ATTR_BLA_VID,308 309 /**310 * @BATADV_ATTR_BLA_BACKBONE: BLA gateway originator MAC address311 */312 BATADV_ATTR_BLA_BACKBONE,313 314 /**315 * @BATADV_ATTR_BLA_CRC: BLA CRC316 */317 BATADV_ATTR_BLA_CRC,318 319 /**320 * @BATADV_ATTR_DAT_CACHE_IP4ADDRESS: Client IPv4 address321 */322 BATADV_ATTR_DAT_CACHE_IP4ADDRESS,323 324 /**325 * @BATADV_ATTR_DAT_CACHE_HWADDRESS: Client MAC address326 */327 BATADV_ATTR_DAT_CACHE_HWADDRESS,328 329 /**330 * @BATADV_ATTR_DAT_CACHE_VID: VLAN ID331 */332 BATADV_ATTR_DAT_CACHE_VID,333 334 /**335 * @BATADV_ATTR_MCAST_FLAGS: Per originator multicast flags336 */337 BATADV_ATTR_MCAST_FLAGS,338 339 /**340 * @BATADV_ATTR_MCAST_FLAGS_PRIV: Private, own multicast flags341 */342 BATADV_ATTR_MCAST_FLAGS_PRIV,343 344 /**345 * @BATADV_ATTR_VLANID: VLAN id on top of soft interface346 */347 BATADV_ATTR_VLANID,348 349 /**350 * @BATADV_ATTR_AGGREGATED_OGMS_ENABLED: whether the batman protocol351 * messages of the mesh interface shall be aggregated or not.352 */353 BATADV_ATTR_AGGREGATED_OGMS_ENABLED,354 355 /**356 * @BATADV_ATTR_AP_ISOLATION_ENABLED: whether the data traffic going357 * from a wireless client to another wireless client will be silently358 * dropped.359 */360 BATADV_ATTR_AP_ISOLATION_ENABLED,361 362 /**363 * @BATADV_ATTR_ISOLATION_MARK: the isolation mark which is used to364 * classify clients as "isolated" by the Extended Isolation feature.365 */366 BATADV_ATTR_ISOLATION_MARK,367 368 /**369 * @BATADV_ATTR_ISOLATION_MASK: the isolation (bit)mask which is used to370 * classify clients as "isolated" by the Extended Isolation feature.371 */372 BATADV_ATTR_ISOLATION_MASK,373 374 /**375 * @BATADV_ATTR_BONDING_ENABLED: whether the data traffic going through376 * the mesh will be sent using multiple interfaces at the same time.377 */378 BATADV_ATTR_BONDING_ENABLED,379 380 /**381 * @BATADV_ATTR_BRIDGE_LOOP_AVOIDANCE_ENABLED: whether the bridge loop382 * avoidance feature is enabled. This feature detects and avoids loops383 * between the mesh and devices bridged with the soft interface384 */385 BATADV_ATTR_BRIDGE_LOOP_AVOIDANCE_ENABLED,386 387 /**388 * @BATADV_ATTR_DISTRIBUTED_ARP_TABLE_ENABLED: whether the distributed389 * arp table feature is enabled. This feature uses a distributed hash390 * table to answer ARP requests without flooding the request through391 * the whole mesh.392 */393 BATADV_ATTR_DISTRIBUTED_ARP_TABLE_ENABLED,394 395 /**396 * @BATADV_ATTR_FRAGMENTATION_ENABLED: whether the data traffic going397 * through the mesh will be fragmented or silently discarded if the398 * packet size exceeds the outgoing interface MTU.399 */400 BATADV_ATTR_FRAGMENTATION_ENABLED,401 402 /**403 * @BATADV_ATTR_GW_BANDWIDTH_DOWN: defines the download bandwidth which404 * is propagated by this node if %BATADV_ATTR_GW_BANDWIDTH_MODE was set405 * to 'server'.406 */407 BATADV_ATTR_GW_BANDWIDTH_DOWN,408 409 /**410 * @BATADV_ATTR_GW_BANDWIDTH_UP: defines the upload bandwidth which411 * is propagated by this node if %BATADV_ATTR_GW_BANDWIDTH_MODE was set412 * to 'server'.413 */414 BATADV_ATTR_GW_BANDWIDTH_UP,415 416 /**417 * @BATADV_ATTR_GW_MODE: defines the state of the gateway features.418 * Possible values are specified in enum batadv_gw_modes419 */420 BATADV_ATTR_GW_MODE,421 422 /**423 * @BATADV_ATTR_GW_SEL_CLASS: defines the selection criteria this node424 * will use to choose a gateway if gw_mode was set to 'client'.425 */426 BATADV_ATTR_GW_SEL_CLASS,427 428 /**429 * @BATADV_ATTR_HOP_PENALTY: defines the penalty which will be applied430 * to an originator message's tq-field on every hop and/or per431 * hard interface432 */433 BATADV_ATTR_HOP_PENALTY,434 435 /**436 * @BATADV_ATTR_LOG_LEVEL: bitmask with to define which debug messages437 * should be send to the debug log/trace ring buffer438 */439 BATADV_ATTR_LOG_LEVEL,440 441 /**442 * @BATADV_ATTR_MULTICAST_FORCEFLOOD_ENABLED: whether multicast443 * optimizations should be replaced by simple broadcast-like flooding444 * of multicast packets. If set to non-zero then all nodes in the mesh445 * are going to use classic flooding for any multicast packet with no446 * optimizations.447 */448 BATADV_ATTR_MULTICAST_FORCEFLOOD_ENABLED,449 450 /**451 * @BATADV_ATTR_NETWORK_CODING_ENABLED: whether Network Coding (using452 * some magic to send fewer wifi packets but still the same content) is453 * enabled or not.454 */455 BATADV_ATTR_NETWORK_CODING_ENABLED,456 457 /**458 * @BATADV_ATTR_ORIG_INTERVAL: defines the interval in milliseconds in459 * which batman sends its protocol messages.460 */461 BATADV_ATTR_ORIG_INTERVAL,462 463 /**464 * @BATADV_ATTR_ELP_INTERVAL: defines the interval in milliseconds in465 * which batman emits probing packets for neighbor sensing (ELP).466 */467 BATADV_ATTR_ELP_INTERVAL,468 469 /**470 * @BATADV_ATTR_THROUGHPUT_OVERRIDE: defines the throughput value to be471 * used by B.A.T.M.A.N. V when estimating the link throughput using472 * this interface. If the value is set to 0 then batman-adv will try to473 * estimate the throughput by itself.474 */475 BATADV_ATTR_THROUGHPUT_OVERRIDE,476 477 /**478 * @BATADV_ATTR_MULTICAST_FANOUT: defines the maximum number of packet479 * copies that may be generated for a multicast-to-unicast conversion.480 * Once this limit is exceeded distribution will fall back to broadcast.481 */482 BATADV_ATTR_MULTICAST_FANOUT,483 484 /* add attributes above here, update the policy in netlink.c */485 486 /**487 * @__BATADV_ATTR_AFTER_LAST: internal use488 */489 __BATADV_ATTR_AFTER_LAST,490 491 /**492 * @NUM_BATADV_ATTR: total number of batadv_nl_attrs available493 */494 NUM_BATADV_ATTR = __BATADV_ATTR_AFTER_LAST,495 496 /**497 * @BATADV_ATTR_MAX: highest attribute number currently defined498 */499 BATADV_ATTR_MAX = __BATADV_ATTR_AFTER_LAST - 1500};501 502/**503 * enum batadv_nl_commands - supported batman-adv netlink commands504 */505enum batadv_nl_commands {506 /**507 * @BATADV_CMD_UNSPEC: unspecified command to catch errors508 */509 BATADV_CMD_UNSPEC,510 511 /**512 * @BATADV_CMD_GET_MESH: Get attributes from softif/mesh513 */514 BATADV_CMD_GET_MESH,515 516 /**517 * @BATADV_CMD_GET_MESH_INFO: Alias for @BATADV_CMD_GET_MESH518 */519 BATADV_CMD_GET_MESH_INFO = BATADV_CMD_GET_MESH,520 521 /**522 * @BATADV_CMD_TP_METER: Start a tp meter session523 */524 BATADV_CMD_TP_METER,525 526 /**527 * @BATADV_CMD_TP_METER_CANCEL: Cancel a tp meter session528 */529 BATADV_CMD_TP_METER_CANCEL,530 531 /**532 * @BATADV_CMD_GET_ROUTING_ALGOS: Query the list of routing algorithms.533 */534 BATADV_CMD_GET_ROUTING_ALGOS,535 536 /**537 * @BATADV_CMD_GET_HARDIF: Get attributes from a hardif of the538 * current softif539 */540 BATADV_CMD_GET_HARDIF,541 542 /**543 * @BATADV_CMD_GET_HARDIFS: Alias for @BATADV_CMD_GET_HARDIF544 */545 BATADV_CMD_GET_HARDIFS = BATADV_CMD_GET_HARDIF,546 547 /**548 * @BATADV_CMD_GET_TRANSTABLE_LOCAL: Query list of local translations549 */550 BATADV_CMD_GET_TRANSTABLE_LOCAL,551 552 /**553 * @BATADV_CMD_GET_TRANSTABLE_GLOBAL: Query list of global translations554 */555 BATADV_CMD_GET_TRANSTABLE_GLOBAL,556 557 /**558 * @BATADV_CMD_GET_ORIGINATORS: Query list of originators559 */560 BATADV_CMD_GET_ORIGINATORS,561 562 /**563 * @BATADV_CMD_GET_NEIGHBORS: Query list of neighbours564 */565 BATADV_CMD_GET_NEIGHBORS,566 567 /**568 * @BATADV_CMD_GET_GATEWAYS: Query list of gateways569 */570 BATADV_CMD_GET_GATEWAYS,571 572 /**573 * @BATADV_CMD_GET_BLA_CLAIM: Query list of bridge loop avoidance claims574 */575 BATADV_CMD_GET_BLA_CLAIM,576 577 /**578 * @BATADV_CMD_GET_BLA_BACKBONE: Query list of bridge loop avoidance579 * backbones580 */581 BATADV_CMD_GET_BLA_BACKBONE,582 583 /**584 * @BATADV_CMD_GET_DAT_CACHE: Query list of DAT cache entries585 */586 BATADV_CMD_GET_DAT_CACHE,587 588 /**589 * @BATADV_CMD_GET_MCAST_FLAGS: Query list of multicast flags590 */591 BATADV_CMD_GET_MCAST_FLAGS,592 593 /**594 * @BATADV_CMD_SET_MESH: Set attributes for softif/mesh595 */596 BATADV_CMD_SET_MESH,597 598 /**599 * @BATADV_CMD_SET_HARDIF: Set attributes for hardif of the600 * current softif601 */602 BATADV_CMD_SET_HARDIF,603 604 /**605 * @BATADV_CMD_GET_VLAN: Get attributes from a VLAN of the606 * current softif607 */608 BATADV_CMD_GET_VLAN,609 610 /**611 * @BATADV_CMD_SET_VLAN: Set attributes for VLAN of the612 * current softif613 */614 BATADV_CMD_SET_VLAN,615 616 /* add new commands above here */617 618 /**619 * @__BATADV_CMD_AFTER_LAST: internal use620 */621 __BATADV_CMD_AFTER_LAST,622 623 /**624 * @BATADV_CMD_MAX: highest used command number625 */626 BATADV_CMD_MAX = __BATADV_CMD_AFTER_LAST - 1627};628 629/**630 * enum batadv_tp_meter_reason - reason of a tp meter test run stop631 */632enum batadv_tp_meter_reason {633 /**634 * @BATADV_TP_REASON_COMPLETE: sender finished tp run635 */636 BATADV_TP_REASON_COMPLETE = 3,637 638 /**639 * @BATADV_TP_REASON_CANCEL: sender was stopped during run640 */641 BATADV_TP_REASON_CANCEL = 4,642 643 /* error status >= 128 */644 645 /**646 * @BATADV_TP_REASON_DST_UNREACHABLE: receiver could not be reached or647 * didn't answer648 */649 BATADV_TP_REASON_DST_UNREACHABLE = 128,650 651 /**652 * @BATADV_TP_REASON_RESEND_LIMIT: (unused) sender retry reached limit653 */654 BATADV_TP_REASON_RESEND_LIMIT = 129,655 656 /**657 * @BATADV_TP_REASON_ALREADY_ONGOING: test to or from the same node658 * already ongoing659 */660 BATADV_TP_REASON_ALREADY_ONGOING = 130,661 662 /**663 * @BATADV_TP_REASON_MEMORY_ERROR: test was stopped due to low memory664 */665 BATADV_TP_REASON_MEMORY_ERROR = 131,666 667 /**668 * @BATADV_TP_REASON_CANT_SEND: failed to send via outgoing interface669 */670 BATADV_TP_REASON_CANT_SEND = 132,671 672 /**673 * @BATADV_TP_REASON_TOO_MANY: too many ongoing sessions674 */675 BATADV_TP_REASON_TOO_MANY = 133,676};677 678/**679 * enum batadv_ifla_attrs - batman-adv ifla nested attributes680 */681enum batadv_ifla_attrs {682 /**683 * @IFLA_BATADV_UNSPEC: unspecified attribute which is not parsed by684 * rtnetlink685 */686 IFLA_BATADV_UNSPEC,687 688 /**689 * @IFLA_BATADV_ALGO_NAME: routing algorithm (name) which should be690 * used by the newly registered batadv net_device.691 */692 IFLA_BATADV_ALGO_NAME,693 694 /* add attributes above here, update the policy in soft-interface.c */695 696 /**697 * @__IFLA_BATADV_MAX: internal use698 */699 __IFLA_BATADV_MAX,700};701 702#define IFLA_BATADV_MAX (__IFLA_BATADV_MAX - 1)703 704#endif /* _UAPI_LINUX_BATMAN_ADV_H_ */705