batman_adv.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  1. /* 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. #ifndef _UAPI_LINUX_BATMAN_ADV_H_
  25. #define _UAPI_LINUX_BATMAN_ADV_H_
  26. #define BATADV_NL_NAME "batadv"
  27. #define BATADV_NL_MCAST_GROUP_TPMETER "tpmeter"
  28. /**
  29. * enum batadv_tt_client_flags - TT client specific flags
  30. *
  31. * Bits from 0 to 7 are called _remote flags_ because they are sent on the wire.
  32. * Bits from 8 to 15 are called _local flags_ because they are used for local
  33. * computations only.
  34. *
  35. * Bits from 4 to 7 - a subset of remote flags - are ensured to be in sync with
  36. * the other nodes in the network. To achieve this goal these flags are included
  37. * in the TT CRC computation.
  38. */
  39. enum batadv_tt_client_flags {
  40. /**
  41. * @BATADV_TT_CLIENT_DEL: the client has to be deleted from the table
  42. */
  43. BATADV_TT_CLIENT_DEL = (1 << 0),
  44. /**
  45. * @BATADV_TT_CLIENT_ROAM: the client roamed to/from another node and
  46. * the new update telling its new real location has not been
  47. * received/sent yet
  48. */
  49. BATADV_TT_CLIENT_ROAM = (1 << 1),
  50. /**
  51. * @BATADV_TT_CLIENT_WIFI: this client is connected through a wifi
  52. * interface. This information is used by the "AP Isolation" feature
  53. */
  54. BATADV_TT_CLIENT_WIFI = (1 << 4),
  55. /**
  56. * @BATADV_TT_CLIENT_ISOLA: this client is considered "isolated". This
  57. * information is used by the Extended Isolation feature
  58. */
  59. BATADV_TT_CLIENT_ISOLA = (1 << 5),
  60. /**
  61. * @BATADV_TT_CLIENT_NOPURGE: this client should never be removed from
  62. * the table
  63. */
  64. BATADV_TT_CLIENT_NOPURGE = (1 << 8),
  65. /**
  66. * @BATADV_TT_CLIENT_NEW: this client has been added to the local table
  67. * but has not been announced yet
  68. */
  69. BATADV_TT_CLIENT_NEW = (1 << 9),
  70. /**
  71. * @BATADV_TT_CLIENT_PENDING: this client is marked for removal but it
  72. * is kept in the table for one more originator interval for consistency
  73. * purposes
  74. */
  75. BATADV_TT_CLIENT_PENDING = (1 << 10),
  76. /**
  77. * @BATADV_TT_CLIENT_TEMP: this global client has been detected to be
  78. * part of the network but no nnode has already announced it
  79. */
  80. BATADV_TT_CLIENT_TEMP = (1 << 11),
  81. };
  82. /**
  83. * enum batadv_mcast_flags_priv - Private, own multicast flags
  84. *
  85. * These are internal, multicast related flags. Currently they describe certain
  86. * multicast related attributes of the segment this originator bridges into the
  87. * mesh.
  88. *
  89. * Those attributes are used to determine the public multicast flags this
  90. * originator is going to announce via TT.
  91. *
  92. * For netlink, if BATADV_MCAST_FLAGS_BRIDGED is unset then all querier
  93. * related flags are undefined.
  94. */
  95. enum batadv_mcast_flags_priv {
  96. /**
  97. * @BATADV_MCAST_FLAGS_BRIDGED: There is a bridge on top of the mesh
  98. * interface.
  99. */
  100. BATADV_MCAST_FLAGS_BRIDGED = (1 << 0),
  101. /**
  102. * @BATADV_MCAST_FLAGS_QUERIER_IPV4_EXISTS: Whether an IGMP querier
  103. * exists in the mesh
  104. */
  105. BATADV_MCAST_FLAGS_QUERIER_IPV4_EXISTS = (1 << 1),
  106. /**
  107. * @BATADV_MCAST_FLAGS_QUERIER_IPV6_EXISTS: Whether an MLD querier
  108. * exists in the mesh
  109. */
  110. BATADV_MCAST_FLAGS_QUERIER_IPV6_EXISTS = (1 << 2),
  111. /**
  112. * @BATADV_MCAST_FLAGS_QUERIER_IPV4_SHADOWING: If an IGMP querier
  113. * exists, whether it is potentially shadowing multicast listeners
  114. * (i.e. querier is behind our own bridge segment)
  115. */
  116. BATADV_MCAST_FLAGS_QUERIER_IPV4_SHADOWING = (1 << 3),
  117. /**
  118. * @BATADV_MCAST_FLAGS_QUERIER_IPV6_SHADOWING: If an MLD querier
  119. * exists, whether it is potentially shadowing multicast listeners
  120. * (i.e. querier is behind our own bridge segment)
  121. */
  122. BATADV_MCAST_FLAGS_QUERIER_IPV6_SHADOWING = (1 << 4),
  123. };
  124. /**
  125. * enum batadv_nl_attrs - batman-adv netlink attributes
  126. */
  127. enum batadv_nl_attrs {
  128. /**
  129. * @BATADV_ATTR_UNSPEC: unspecified attribute to catch errors
  130. */
  131. BATADV_ATTR_UNSPEC,
  132. /**
  133. * @BATADV_ATTR_VERSION: batman-adv version string
  134. */
  135. BATADV_ATTR_VERSION,
  136. /**
  137. * @BATADV_ATTR_ALGO_NAME: name of routing algorithm
  138. */
  139. BATADV_ATTR_ALGO_NAME,
  140. /**
  141. * @BATADV_ATTR_MESH_IFINDEX: index of the batman-adv interface
  142. */
  143. BATADV_ATTR_MESH_IFINDEX,
  144. /**
  145. * @BATADV_ATTR_MESH_IFNAME: name of the batman-adv interface
  146. */
  147. BATADV_ATTR_MESH_IFNAME,
  148. /**
  149. * @BATADV_ATTR_MESH_ADDRESS: mac address of the batman-adv interface
  150. */
  151. BATADV_ATTR_MESH_ADDRESS,
  152. /**
  153. * @BATADV_ATTR_HARD_IFINDEX: index of the non-batman-adv interface
  154. */
  155. BATADV_ATTR_HARD_IFINDEX,
  156. /**
  157. * @BATADV_ATTR_HARD_IFNAME: name of the non-batman-adv interface
  158. */
  159. BATADV_ATTR_HARD_IFNAME,
  160. /**
  161. * @BATADV_ATTR_HARD_ADDRESS: mac address of the non-batman-adv
  162. * interface
  163. */
  164. BATADV_ATTR_HARD_ADDRESS,
  165. /**
  166. * @BATADV_ATTR_ORIG_ADDRESS: originator mac address
  167. */
  168. BATADV_ATTR_ORIG_ADDRESS,
  169. /**
  170. * @BATADV_ATTR_TPMETER_RESULT: result of run (see
  171. * batadv_tp_meter_status)
  172. */
  173. BATADV_ATTR_TPMETER_RESULT,
  174. /**
  175. * @BATADV_ATTR_TPMETER_TEST_TIME: time (msec) the run took
  176. */
  177. BATADV_ATTR_TPMETER_TEST_TIME,
  178. /**
  179. * @BATADV_ATTR_TPMETER_BYTES: amount of acked bytes during run
  180. */
  181. BATADV_ATTR_TPMETER_BYTES,
  182. /**
  183. * @BATADV_ATTR_TPMETER_COOKIE: session cookie to match tp_meter session
  184. */
  185. BATADV_ATTR_TPMETER_COOKIE,
  186. /**
  187. * @BATADV_ATTR_PAD: attribute used for padding for 64-bit alignment
  188. */
  189. BATADV_ATTR_PAD,
  190. /**
  191. * @BATADV_ATTR_ACTIVE: Flag indicating if the hard interface is active
  192. */
  193. BATADV_ATTR_ACTIVE,
  194. /**
  195. * @BATADV_ATTR_TT_ADDRESS: Client MAC address
  196. */
  197. BATADV_ATTR_TT_ADDRESS,
  198. /**
  199. * @BATADV_ATTR_TT_TTVN: Translation table version
  200. */
  201. BATADV_ATTR_TT_TTVN,
  202. /**
  203. * @BATADV_ATTR_TT_LAST_TTVN: Previous translation table version
  204. */
  205. BATADV_ATTR_TT_LAST_TTVN,
  206. /**
  207. * @BATADV_ATTR_TT_CRC32: CRC32 over translation table
  208. */
  209. BATADV_ATTR_TT_CRC32,
  210. /**
  211. * @BATADV_ATTR_TT_VID: VLAN ID
  212. */
  213. BATADV_ATTR_TT_VID,
  214. /**
  215. * @BATADV_ATTR_TT_FLAGS: Translation table client flags
  216. */
  217. BATADV_ATTR_TT_FLAGS,
  218. /**
  219. * @BATADV_ATTR_FLAG_BEST: Flags indicating entry is the best
  220. */
  221. BATADV_ATTR_FLAG_BEST,
  222. /**
  223. * @BATADV_ATTR_LAST_SEEN_MSECS: Time in milliseconds since last seen
  224. */
  225. BATADV_ATTR_LAST_SEEN_MSECS,
  226. /**
  227. * @BATADV_ATTR_NEIGH_ADDRESS: Neighbour MAC address
  228. */
  229. BATADV_ATTR_NEIGH_ADDRESS,
  230. /**
  231. * @BATADV_ATTR_TQ: TQ to neighbour
  232. */
  233. BATADV_ATTR_TQ,
  234. /**
  235. * @BATADV_ATTR_THROUGHPUT: Estimated throughput to Neighbour
  236. */
  237. BATADV_ATTR_THROUGHPUT,
  238. /**
  239. * @BATADV_ATTR_BANDWIDTH_UP: Reported uplink bandwidth
  240. */
  241. BATADV_ATTR_BANDWIDTH_UP,
  242. /**
  243. * @BATADV_ATTR_BANDWIDTH_DOWN: Reported downlink bandwidth
  244. */
  245. BATADV_ATTR_BANDWIDTH_DOWN,
  246. /**
  247. * @BATADV_ATTR_ROUTER: Gateway router MAC address
  248. */
  249. BATADV_ATTR_ROUTER,
  250. /**
  251. * @BATADV_ATTR_BLA_OWN: Flag indicating own originator
  252. */
  253. BATADV_ATTR_BLA_OWN,
  254. /**
  255. * @BATADV_ATTR_BLA_ADDRESS: Bridge loop avoidance claim MAC address
  256. */
  257. BATADV_ATTR_BLA_ADDRESS,
  258. /**
  259. * @BATADV_ATTR_BLA_VID: BLA VLAN ID
  260. */
  261. BATADV_ATTR_BLA_VID,
  262. /**
  263. * @BATADV_ATTR_BLA_BACKBONE: BLA gateway originator MAC address
  264. */
  265. BATADV_ATTR_BLA_BACKBONE,
  266. /**
  267. * @BATADV_ATTR_BLA_CRC: BLA CRC
  268. */
  269. BATADV_ATTR_BLA_CRC,
  270. /**
  271. * @BATADV_ATTR_DAT_CACHE_IP4ADDRESS: Client IPv4 address
  272. */
  273. BATADV_ATTR_DAT_CACHE_IP4ADDRESS,
  274. /**
  275. * @BATADV_ATTR_DAT_CACHE_HWADDRESS: Client MAC address
  276. */
  277. BATADV_ATTR_DAT_CACHE_HWADDRESS,
  278. /**
  279. * @BATADV_ATTR_DAT_CACHE_VID: VLAN ID
  280. */
  281. BATADV_ATTR_DAT_CACHE_VID,
  282. /**
  283. * @BATADV_ATTR_MCAST_FLAGS: Per originator multicast flags
  284. */
  285. BATADV_ATTR_MCAST_FLAGS,
  286. /**
  287. * @BATADV_ATTR_MCAST_FLAGS_PRIV: Private, own multicast flags
  288. */
  289. BATADV_ATTR_MCAST_FLAGS_PRIV,
  290. /* add attributes above here, update the policy in netlink.c */
  291. /**
  292. * @__BATADV_ATTR_AFTER_LAST: internal use
  293. */
  294. __BATADV_ATTR_AFTER_LAST,
  295. /**
  296. * @NUM_BATADV_ATTR: total number of batadv_nl_attrs available
  297. */
  298. NUM_BATADV_ATTR = __BATADV_ATTR_AFTER_LAST,
  299. /**
  300. * @BATADV_ATTR_MAX: highest attribute number currently defined
  301. */
  302. BATADV_ATTR_MAX = __BATADV_ATTR_AFTER_LAST - 1
  303. };
  304. /**
  305. * enum batadv_nl_commands - supported batman-adv netlink commands
  306. */
  307. enum batadv_nl_commands {
  308. /**
  309. * @BATADV_CMD_UNSPEC: unspecified command to catch errors
  310. */
  311. BATADV_CMD_UNSPEC,
  312. /**
  313. * @BATADV_CMD_GET_MESH_INFO: Query basic information about batman-adv
  314. * device
  315. */
  316. BATADV_CMD_GET_MESH_INFO,
  317. /**
  318. * @BATADV_CMD_TP_METER: Start a tp meter session
  319. */
  320. BATADV_CMD_TP_METER,
  321. /**
  322. * @BATADV_CMD_TP_METER_CANCEL: Cancel a tp meter session
  323. */
  324. BATADV_CMD_TP_METER_CANCEL,
  325. /**
  326. * @BATADV_CMD_GET_ROUTING_ALGOS: Query the list of routing algorithms.
  327. */
  328. BATADV_CMD_GET_ROUTING_ALGOS,
  329. /**
  330. * @BATADV_CMD_GET_HARDIFS: Query list of hard interfaces
  331. */
  332. BATADV_CMD_GET_HARDIFS,
  333. /**
  334. * @BATADV_CMD_GET_TRANSTABLE_LOCAL: Query list of local translations
  335. */
  336. BATADV_CMD_GET_TRANSTABLE_LOCAL,
  337. /**
  338. * @BATADV_CMD_GET_TRANSTABLE_GLOBAL: Query list of global translations
  339. */
  340. BATADV_CMD_GET_TRANSTABLE_GLOBAL,
  341. /**
  342. * @BATADV_CMD_GET_ORIGINATORS: Query list of originators
  343. */
  344. BATADV_CMD_GET_ORIGINATORS,
  345. /**
  346. * @BATADV_CMD_GET_NEIGHBORS: Query list of neighbours
  347. */
  348. BATADV_CMD_GET_NEIGHBORS,
  349. /**
  350. * @BATADV_CMD_GET_GATEWAYS: Query list of gateways
  351. */
  352. BATADV_CMD_GET_GATEWAYS,
  353. /**
  354. * @BATADV_CMD_GET_BLA_CLAIM: Query list of bridge loop avoidance claims
  355. */
  356. BATADV_CMD_GET_BLA_CLAIM,
  357. /**
  358. * @BATADV_CMD_GET_BLA_BACKBONE: Query list of bridge loop avoidance
  359. * backbones
  360. */
  361. BATADV_CMD_GET_BLA_BACKBONE,
  362. /**
  363. * @BATADV_CMD_GET_DAT_CACHE: Query list of DAT cache entries
  364. */
  365. BATADV_CMD_GET_DAT_CACHE,
  366. /**
  367. * @BATADV_CMD_GET_MCAST_FLAGS: Query list of multicast flags
  368. */
  369. BATADV_CMD_GET_MCAST_FLAGS,
  370. /* add new commands above here */
  371. /**
  372. * @__BATADV_CMD_AFTER_LAST: internal use
  373. */
  374. __BATADV_CMD_AFTER_LAST,
  375. /**
  376. * @BATADV_CMD_MAX: highest used command number
  377. */
  378. BATADV_CMD_MAX = __BATADV_CMD_AFTER_LAST - 1
  379. };
  380. /**
  381. * enum batadv_tp_meter_reason - reason of a tp meter test run stop
  382. */
  383. enum batadv_tp_meter_reason {
  384. /**
  385. * @BATADV_TP_REASON_COMPLETE: sender finished tp run
  386. */
  387. BATADV_TP_REASON_COMPLETE = 3,
  388. /**
  389. * @BATADV_TP_REASON_CANCEL: sender was stopped during run
  390. */
  391. BATADV_TP_REASON_CANCEL = 4,
  392. /* error status >= 128 */
  393. /**
  394. * @BATADV_TP_REASON_DST_UNREACHABLE: receiver could not be reached or
  395. * didn't answer
  396. */
  397. BATADV_TP_REASON_DST_UNREACHABLE = 128,
  398. /**
  399. * @BATADV_TP_REASON_RESEND_LIMIT: (unused) sender retry reached limit
  400. */
  401. BATADV_TP_REASON_RESEND_LIMIT = 129,
  402. /**
  403. * @BATADV_TP_REASON_ALREADY_ONGOING: test to or from the same node
  404. * already ongoing
  405. */
  406. BATADV_TP_REASON_ALREADY_ONGOING = 130,
  407. /**
  408. * @BATADV_TP_REASON_MEMORY_ERROR: test was stopped due to low memory
  409. */
  410. BATADV_TP_REASON_MEMORY_ERROR = 131,
  411. /**
  412. * @BATADV_TP_REASON_CANT_SEND: failed to send via outgoing interface
  413. */
  414. BATADV_TP_REASON_CANT_SEND = 132,
  415. /**
  416. * @BATADV_TP_REASON_TOO_MANY: too many ongoing sessions
  417. */
  418. BATADV_TP_REASON_TOO_MANY = 133,
  419. };
  420. #endif /* _UAPI_LINUX_BATMAN_ADV_H_ */