logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

batadv_packet.h (21632B)


  1. /* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) */
  2. /* Copyright (C) B.A.T.M.A.N. contributors:
  3. *
  4. * Marek Lindner, Simon Wunderlich
  5. */
  6. #ifndef _LINUX_BATADV_PACKET_H_
  7. #define _LINUX_BATADV_PACKET_H_
  8. #include <asm/byteorder.h>
  9. #include <linux/if_ether.h>
  10. #include <linux/types.h>
  11. /**
  12. * batadv_tp_is_error() - Check throughput meter return code for error
  13. * @n: throughput meter return code
  14. *
  15. * Return: 0 when not error was detected, != 0 otherwise
  16. */
  17. #define batadv_tp_is_error(n) ((__u8)(n) > 127 ? 1 : 0)
  18. /**
  19. * enum batadv_packettype - types for batman-adv encapsulated packets
  20. * @BATADV_IV_OGM: originator messages for B.A.T.M.A.N. IV
  21. * @BATADV_BCAST: broadcast packets carrying broadcast payload
  22. * @BATADV_CODED: network coded packets
  23. * @BATADV_ELP: echo location packets for B.A.T.M.A.N. V
  24. * @BATADV_OGM2: originator messages for B.A.T.M.A.N. V
  25. * @BATADV_MCAST: multicast packet with multiple destination addresses
  26. *
  27. * @BATADV_UNICAST: unicast packets carrying unicast payload traffic
  28. * @BATADV_UNICAST_FRAG: unicast packets carrying a fragment of the original
  29. * payload packet
  30. * @BATADV_UNICAST_4ADDR: unicast packet including the originator address of
  31. * the sender
  32. * @BATADV_ICMP: unicast packet like IP ICMP used for ping or traceroute
  33. * @BATADV_UNICAST_TVLV: unicast packet carrying TVLV containers
  34. */
  35. enum batadv_packettype {
  36. /* 0x00 - 0x3f: local packets or special rules for handling */
  37. BATADV_IV_OGM = 0x00,
  38. BATADV_BCAST = 0x01,
  39. BATADV_CODED = 0x02,
  40. BATADV_ELP = 0x03,
  41. BATADV_OGM2 = 0x04,
  42. BATADV_MCAST = 0x05,
  43. /* 0x40 - 0x7f: unicast */
  44. #define BATADV_UNICAST_MIN 0x40
  45. BATADV_UNICAST = 0x40,
  46. BATADV_UNICAST_FRAG = 0x41,
  47. BATADV_UNICAST_4ADDR = 0x42,
  48. BATADV_ICMP = 0x43,
  49. BATADV_UNICAST_TVLV = 0x44,
  50. #define BATADV_UNICAST_MAX 0x7f
  51. /* 0x80 - 0xff: reserved */
  52. };
  53. /**
  54. * enum batadv_subtype - packet subtype for unicast4addr
  55. * @BATADV_P_DATA: user payload
  56. * @BATADV_P_DAT_DHT_GET: DHT request message
  57. * @BATADV_P_DAT_DHT_PUT: DHT store message
  58. * @BATADV_P_DAT_CACHE_REPLY: ARP reply generated by DAT
  59. */
  60. enum batadv_subtype {
  61. BATADV_P_DATA = 0x01,
  62. BATADV_P_DAT_DHT_GET = 0x02,
  63. BATADV_P_DAT_DHT_PUT = 0x03,
  64. BATADV_P_DAT_CACHE_REPLY = 0x04,
  65. };
  66. /* this file is included by batctl which needs these defines */
  67. #define BATADV_COMPAT_VERSION 15
  68. /**
  69. * enum batadv_iv_flags - flags used in B.A.T.M.A.N. IV OGM packets
  70. * @BATADV_NOT_BEST_NEXT_HOP: flag is set when the ogm packet is forwarded and
  71. * was previously received from someone other than the best neighbor.
  72. * @BATADV_PRIMARIES_FIRST_HOP: flag unused.
  73. * @BATADV_DIRECTLINK: flag is for the first hop or if rebroadcasted from a
  74. * one hop neighbor on the interface where it was originally received.
  75. */
  76. enum batadv_iv_flags {
  77. BATADV_NOT_BEST_NEXT_HOP = 1UL << 0,
  78. BATADV_PRIMARIES_FIRST_HOP = 1UL << 1,
  79. BATADV_DIRECTLINK = 1UL << 2,
  80. };
  81. /**
  82. * enum batadv_icmp_packettype - ICMP message types
  83. * @BATADV_ECHO_REPLY: success reply to BATADV_ECHO_REQUEST
  84. * @BATADV_DESTINATION_UNREACHABLE: failure when route to destination not found
  85. * @BATADV_ECHO_REQUEST: request BATADV_ECHO_REPLY from destination
  86. * @BATADV_TTL_EXCEEDED: error after BATADV_ECHO_REQUEST traversed too many hops
  87. * @BATADV_PARAMETER_PROBLEM: return code for malformed messages
  88. * @BATADV_TP: throughput meter packet
  89. */
  90. enum batadv_icmp_packettype {
  91. BATADV_ECHO_REPLY = 0,
  92. BATADV_DESTINATION_UNREACHABLE = 3,
  93. BATADV_ECHO_REQUEST = 8,
  94. BATADV_TTL_EXCEEDED = 11,
  95. BATADV_PARAMETER_PROBLEM = 12,
  96. BATADV_TP = 15,
  97. };
  98. /**
  99. * enum batadv_mcast_flags - flags for multicast capabilities and settings
  100. * @BATADV_MCAST_WANT_ALL_UNSNOOPABLES: we want all packets destined for
  101. * 224.0.0.0/24 or ff02::1
  102. * @BATADV_MCAST_WANT_ALL_IPV4: we want all IPv4 multicast packets
  103. * (both link-local and routable ones)
  104. * @BATADV_MCAST_WANT_ALL_IPV6: we want all IPv6 multicast packets
  105. * (both link-local and routable ones)
  106. * @BATADV_MCAST_WANT_NO_RTR4: we have no IPv4 multicast router and therefore
  107. * only need routable IPv4 multicast packets we signed up for explicitly
  108. * @BATADV_MCAST_WANT_NO_RTR6: we have no IPv6 multicast router and therefore
  109. * only need routable IPv6 multicast packets we signed up for explicitly
  110. * @BATADV_MCAST_HAVE_MC_PTYPE_CAPA: we can parse, receive and forward
  111. * batman-adv multicast packets with a multicast tracker TVLV. And all our
  112. * hard interfaces have an MTU of at least 1280 bytes.
  113. */
  114. enum batadv_mcast_flags {
  115. BATADV_MCAST_WANT_ALL_UNSNOOPABLES = 1UL << 0,
  116. BATADV_MCAST_WANT_ALL_IPV4 = 1UL << 1,
  117. BATADV_MCAST_WANT_ALL_IPV6 = 1UL << 2,
  118. BATADV_MCAST_WANT_NO_RTR4 = 1UL << 3,
  119. BATADV_MCAST_WANT_NO_RTR6 = 1UL << 4,
  120. BATADV_MCAST_HAVE_MC_PTYPE_CAPA = 1UL << 5,
  121. };
  122. /* tt data subtypes */
  123. #define BATADV_TT_DATA_TYPE_MASK 0x0F
  124. /**
  125. * enum batadv_tt_data_flags - flags for tt data tvlv
  126. * @BATADV_TT_OGM_DIFF: TT diff propagated through OGM
  127. * @BATADV_TT_REQUEST: TT request message
  128. * @BATADV_TT_RESPONSE: TT response message
  129. * @BATADV_TT_FULL_TABLE: contains full table to replace existing table
  130. */
  131. enum batadv_tt_data_flags {
  132. BATADV_TT_OGM_DIFF = 1UL << 0,
  133. BATADV_TT_REQUEST = 1UL << 1,
  134. BATADV_TT_RESPONSE = 1UL << 2,
  135. BATADV_TT_FULL_TABLE = 1UL << 4,
  136. };
  137. /**
  138. * enum batadv_vlan_flags - flags for the four MSB of any vlan ID field
  139. * @BATADV_VLAN_HAS_TAG: whether the field contains a valid vlan tag or not
  140. */
  141. enum batadv_vlan_flags {
  142. BATADV_VLAN_HAS_TAG = 1UL << 15,
  143. };
  144. /**
  145. * enum batadv_bla_claimframe - claim frame types for the bridge loop avoidance
  146. * @BATADV_CLAIM_TYPE_CLAIM: claim of a client mac address
  147. * @BATADV_CLAIM_TYPE_UNCLAIM: unclaim of a client mac address
  148. * @BATADV_CLAIM_TYPE_ANNOUNCE: announcement of backbone with current crc
  149. * @BATADV_CLAIM_TYPE_REQUEST: request of full claim table
  150. * @BATADV_CLAIM_TYPE_LOOPDETECT: mesh-traversing loop detect packet
  151. */
  152. enum batadv_bla_claimframe {
  153. BATADV_CLAIM_TYPE_CLAIM = 0x00,
  154. BATADV_CLAIM_TYPE_UNCLAIM = 0x01,
  155. BATADV_CLAIM_TYPE_ANNOUNCE = 0x02,
  156. BATADV_CLAIM_TYPE_REQUEST = 0x03,
  157. BATADV_CLAIM_TYPE_LOOPDETECT = 0x04,
  158. };
  159. /**
  160. * enum batadv_tvlv_type - tvlv type definitions
  161. * @BATADV_TVLV_GW: gateway tvlv
  162. * @BATADV_TVLV_DAT: distributed arp table tvlv
  163. * @BATADV_TVLV_NC: network coding tvlv
  164. * @BATADV_TVLV_TT: translation table tvlv
  165. * @BATADV_TVLV_ROAM: roaming advertisement tvlv
  166. * @BATADV_TVLV_MCAST: multicast capability tvlv
  167. * @BATADV_TVLV_MCAST_TRACKER: multicast tracker tvlv
  168. */
  169. enum batadv_tvlv_type {
  170. BATADV_TVLV_GW = 0x01,
  171. BATADV_TVLV_DAT = 0x02,
  172. BATADV_TVLV_NC = 0x03,
  173. BATADV_TVLV_TT = 0x04,
  174. BATADV_TVLV_ROAM = 0x05,
  175. BATADV_TVLV_MCAST = 0x06,
  176. BATADV_TVLV_MCAST_TRACKER = 0x07,
  177. };
  178. #pragma pack(2)
  179. /* the destination hardware field in the ARP frame is used to
  180. * transport the claim type and the group id
  181. */
  182. struct batadv_bla_claim_dst {
  183. __u8 magic[3]; /* FF:43:05 */
  184. __u8 type; /* bla_claimframe */
  185. __be16 group; /* group id */
  186. };
  187. /**
  188. * struct batadv_ogm_packet - ogm (routing protocol) packet
  189. * @packet_type: batman-adv packet type, part of the general header
  190. * @version: batman-adv protocol version, part of the general header
  191. * @ttl: time to live for this packet, part of the general header
  192. * @flags: contains routing relevant flags - see enum batadv_iv_flags
  193. * @seqno: sequence identification
  194. * @orig: address of the source node
  195. * @prev_sender: address of the previous sender
  196. * @reserved: reserved byte for alignment
  197. * @tq: transmission quality
  198. * @tvlv_len: length of tvlv data following the ogm header
  199. */
  200. struct batadv_ogm_packet {
  201. __u8 packet_type;
  202. __u8 version;
  203. __u8 ttl;
  204. __u8 flags;
  205. __be32 seqno;
  206. __u8 orig[ETH_ALEN];
  207. __u8 prev_sender[ETH_ALEN];
  208. __u8 reserved;
  209. __u8 tq;
  210. __be16 tvlv_len;
  211. };
  212. #define BATADV_OGM_HLEN sizeof(struct batadv_ogm_packet)
  213. /**
  214. * struct batadv_ogm2_packet - ogm2 (routing protocol) packet
  215. * @packet_type: batman-adv packet type, part of the general header
  216. * @version: batman-adv protocol version, part of the general header
  217. * @ttl: time to live for this packet, part of the general header
  218. * @flags: reserved for routing relevant flags - currently always 0
  219. * @seqno: sequence number
  220. * @orig: originator mac address
  221. * @tvlv_len: length of the appended tvlv buffer (in bytes)
  222. * @throughput: the currently flooded path throughput
  223. */
  224. struct batadv_ogm2_packet {
  225. __u8 packet_type;
  226. __u8 version;
  227. __u8 ttl;
  228. __u8 flags;
  229. __be32 seqno;
  230. __u8 orig[ETH_ALEN];
  231. __be16 tvlv_len;
  232. __be32 throughput;
  233. };
  234. #define BATADV_OGM2_HLEN sizeof(struct batadv_ogm2_packet)
  235. /**
  236. * struct batadv_elp_packet - elp (neighbor discovery) packet
  237. * @packet_type: batman-adv packet type, part of the general header
  238. * @version: batman-adv protocol version, part of the general header
  239. * @orig: originator mac address
  240. * @seqno: sequence number
  241. * @elp_interval: currently used ELP sending interval in ms
  242. */
  243. struct batadv_elp_packet {
  244. __u8 packet_type;
  245. __u8 version;
  246. __u8 orig[ETH_ALEN];
  247. __be32 seqno;
  248. __be32 elp_interval;
  249. };
  250. #define BATADV_ELP_HLEN sizeof(struct batadv_elp_packet)
  251. /**
  252. * struct batadv_icmp_header - common members among all the ICMP packets
  253. * @packet_type: batman-adv packet type, part of the general header
  254. * @version: batman-adv protocol version, part of the general header
  255. * @ttl: time to live for this packet, part of the general header
  256. * @msg_type: ICMP packet type
  257. * @dst: address of the destination node
  258. * @orig: address of the source node
  259. * @uid: local ICMP socket identifier
  260. * @align: not used - useful for alignment purposes only
  261. *
  262. * This structure is used for ICMP packet parsing only and it is never sent
  263. * over the wire. The alignment field at the end is there to ensure that
  264. * members are padded the same way as they are in real packets.
  265. */
  266. struct batadv_icmp_header {
  267. __u8 packet_type;
  268. __u8 version;
  269. __u8 ttl;
  270. __u8 msg_type; /* see ICMP message types above */
  271. __u8 dst[ETH_ALEN];
  272. __u8 orig[ETH_ALEN];
  273. __u8 uid;
  274. __u8 align[3];
  275. };
  276. /**
  277. * struct batadv_icmp_packet - ICMP packet
  278. * @packet_type: batman-adv packet type, part of the general header
  279. * @version: batman-adv protocol version, part of the general header
  280. * @ttl: time to live for this packet, part of the general header
  281. * @msg_type: ICMP packet type
  282. * @dst: address of the destination node
  283. * @orig: address of the source node
  284. * @uid: local ICMP socket identifier
  285. * @reserved: not used - useful for alignment
  286. * @seqno: ICMP sequence number
  287. */
  288. struct batadv_icmp_packet {
  289. __u8 packet_type;
  290. __u8 version;
  291. __u8 ttl;
  292. __u8 msg_type; /* see ICMP message types above */
  293. __u8 dst[ETH_ALEN];
  294. __u8 orig[ETH_ALEN];
  295. __u8 uid;
  296. __u8 reserved;
  297. __be16 seqno;
  298. };
  299. /**
  300. * struct batadv_icmp_tp_packet - ICMP TP Meter packet
  301. * @packet_type: batman-adv packet type, part of the general header
  302. * @version: batman-adv protocol version, part of the general header
  303. * @ttl: time to live for this packet, part of the general header
  304. * @msg_type: ICMP packet type
  305. * @dst: address of the destination node
  306. * @orig: address of the source node
  307. * @uid: local ICMP socket identifier
  308. * @subtype: TP packet subtype (see batadv_icmp_tp_subtype)
  309. * @session: TP session identifier
  310. * @seqno: the TP sequence number
  311. * @timestamp: time when the packet has been sent. This value is filled in a
  312. * TP_MSG and echoed back in the next TP_ACK so that the sender can compute the
  313. * RTT. Since it is read only by the host which wrote it, there is no need to
  314. * store it using network order
  315. */
  316. struct batadv_icmp_tp_packet {
  317. __u8 packet_type;
  318. __u8 version;
  319. __u8 ttl;
  320. __u8 msg_type; /* see ICMP message types above */
  321. __u8 dst[ETH_ALEN];
  322. __u8 orig[ETH_ALEN];
  323. __u8 uid;
  324. __u8 subtype;
  325. __u8 session[2];
  326. __be32 seqno;
  327. __be32 timestamp;
  328. };
  329. /**
  330. * enum batadv_icmp_tp_subtype - ICMP TP Meter packet subtypes
  331. * @BATADV_TP_MSG: Msg from sender to receiver
  332. * @BATADV_TP_ACK: acknowledgment from receiver to sender
  333. */
  334. enum batadv_icmp_tp_subtype {
  335. BATADV_TP_MSG = 0,
  336. BATADV_TP_ACK,
  337. };
  338. #define BATADV_RR_LEN 16
  339. /**
  340. * struct batadv_icmp_packet_rr - ICMP RouteRecord packet
  341. * @packet_type: batman-adv packet type, part of the general header
  342. * @version: batman-adv protocol version, part of the general header
  343. * @ttl: time to live for this packet, part of the general header
  344. * @msg_type: ICMP packet type
  345. * @dst: address of the destination node
  346. * @orig: address of the source node
  347. * @uid: local ICMP socket identifier
  348. * @rr_cur: number of entries the rr array
  349. * @seqno: ICMP sequence number
  350. * @rr: route record array
  351. */
  352. struct batadv_icmp_packet_rr {
  353. __u8 packet_type;
  354. __u8 version;
  355. __u8 ttl;
  356. __u8 msg_type; /* see ICMP message types above */
  357. __u8 dst[ETH_ALEN];
  358. __u8 orig[ETH_ALEN];
  359. __u8 uid;
  360. __u8 rr_cur;
  361. __be16 seqno;
  362. __u8 rr[BATADV_RR_LEN][ETH_ALEN];
  363. };
  364. #define BATADV_ICMP_MAX_PACKET_SIZE sizeof(struct batadv_icmp_packet_rr)
  365. /* All packet headers in front of an ethernet header have to be completely
  366. * divisible by 2 but not by 4 to make the payload after the ethernet
  367. * header again 4 bytes boundary aligned.
  368. *
  369. * A packing of 2 is necessary to avoid extra padding at the end of the struct
  370. * caused by a structure member which is larger than two bytes. Otherwise
  371. * the structure would not fulfill the previously mentioned rule to avoid the
  372. * misalignment of the payload after the ethernet header. It may also lead to
  373. * leakage of information when the padding it not initialized before sending.
  374. */
  375. /**
  376. * struct batadv_unicast_packet - unicast packet for network payload
  377. * @packet_type: batman-adv packet type, part of the general header
  378. * @version: batman-adv protocol version, part of the general header
  379. * @ttl: time to live for this packet, part of the general header
  380. * @ttvn: translation table version number
  381. * @dest: originator destination of the unicast packet
  382. */
  383. struct batadv_unicast_packet {
  384. __u8 packet_type;
  385. __u8 version;
  386. __u8 ttl;
  387. __u8 ttvn; /* destination translation table version number */
  388. __u8 dest[ETH_ALEN];
  389. /* "4 bytes boundary + 2 bytes" long to make the payload after the
  390. * following ethernet header again 4 bytes boundary aligned
  391. */
  392. };
  393. /**
  394. * struct batadv_unicast_4addr_packet - extended unicast packet
  395. * @u: common unicast packet header
  396. * @src: address of the source
  397. * @subtype: packet subtype
  398. * @reserved: reserved byte for alignment
  399. */
  400. struct batadv_unicast_4addr_packet {
  401. struct batadv_unicast_packet u;
  402. __u8 src[ETH_ALEN];
  403. __u8 subtype;
  404. __u8 reserved;
  405. /* "4 bytes boundary + 2 bytes" long to make the payload after the
  406. * following ethernet header again 4 bytes boundary aligned
  407. */
  408. };
  409. /**
  410. * struct batadv_frag_packet - fragmented packet
  411. * @packet_type: batman-adv packet type, part of the general header
  412. * @version: batman-adv protocol version, part of the general header
  413. * @ttl: time to live for this packet, part of the general header
  414. * @dest: final destination used when routing fragments
  415. * @orig: originator of the fragment used when merging the packet
  416. * @no: fragment number within this sequence
  417. * @priority: priority of frame, from ToS IP precedence or 802.1p
  418. * @reserved: reserved byte for alignment
  419. * @seqno: sequence identification
  420. * @total_size: size of the merged packet
  421. */
  422. struct batadv_frag_packet {
  423. __u8 packet_type;
  424. __u8 version; /* batman version field */
  425. __u8 ttl;
  426. #if defined(__BIG_ENDIAN_BITFIELD)
  427. __u8 no:4;
  428. __u8 priority:3;
  429. __u8 reserved:1;
  430. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  431. __u8 reserved:1;
  432. __u8 priority:3;
  433. __u8 no:4;
  434. #else
  435. #error "unknown bitfield endianness"
  436. #endif
  437. __u8 dest[ETH_ALEN];
  438. __u8 orig[ETH_ALEN];
  439. __be16 seqno;
  440. __be16 total_size;
  441. };
  442. /**
  443. * struct batadv_bcast_packet - broadcast packet for network payload
  444. * @packet_type: batman-adv packet type, part of the general header
  445. * @version: batman-adv protocol version, part of the general header
  446. * @ttl: time to live for this packet, part of the general header
  447. * @reserved: reserved byte for alignment
  448. * @seqno: sequence identification
  449. * @orig: originator of the broadcast packet
  450. */
  451. struct batadv_bcast_packet {
  452. __u8 packet_type;
  453. __u8 version; /* batman version field */
  454. __u8 ttl;
  455. __u8 reserved;
  456. __be32 seqno;
  457. __u8 orig[ETH_ALEN];
  458. /* "4 bytes boundary + 2 bytes" long to make the payload after the
  459. * following ethernet header again 4 bytes boundary aligned
  460. */
  461. };
  462. /**
  463. * struct batadv_mcast_packet - multicast packet for network payload
  464. * @packet_type: batman-adv packet type, part of the general header
  465. * @version: batman-adv protocol version, part of the general header
  466. * @ttl: time to live for this packet, part of the general header
  467. * @reserved: reserved byte for alignment
  468. * @tvlv_len: length of the appended tvlv buffer (in bytes)
  469. */
  470. struct batadv_mcast_packet {
  471. __u8 packet_type;
  472. __u8 version;
  473. __u8 ttl;
  474. __u8 reserved;
  475. __be16 tvlv_len;
  476. /* "4 bytes boundary + 2 bytes" long to make the payload after the
  477. * following ethernet header again 4 bytes boundary aligned
  478. */
  479. };
  480. /**
  481. * struct batadv_coded_packet - network coded packet
  482. * @packet_type: batman-adv packet type, part of the general header
  483. * @version: batman-adv protocol version, part of the general header
  484. * @ttl: time to live for this packet, part of the general header
  485. * @first_source: original source of first included packet
  486. * @first_orig_dest: original destination of first included packet
  487. * @first_crc: checksum of first included packet
  488. * @first_ttvn: tt-version number of first included packet
  489. * @second_ttl: ttl of second packet
  490. * @second_dest: second receiver of this coded packet
  491. * @second_source: original source of second included packet
  492. * @second_orig_dest: original destination of second included packet
  493. * @second_crc: checksum of second included packet
  494. * @second_ttvn: tt version number of second included packet
  495. * @coded_len: length of network coded part of the payload
  496. */
  497. struct batadv_coded_packet {
  498. __u8 packet_type;
  499. __u8 version; /* batman version field */
  500. __u8 ttl;
  501. __u8 first_ttvn;
  502. /* __u8 first_dest[ETH_ALEN]; - saved in mac header destination */
  503. __u8 first_source[ETH_ALEN];
  504. __u8 first_orig_dest[ETH_ALEN];
  505. __be32 first_crc;
  506. __u8 second_ttl;
  507. __u8 second_ttvn;
  508. __u8 second_dest[ETH_ALEN];
  509. __u8 second_source[ETH_ALEN];
  510. __u8 second_orig_dest[ETH_ALEN];
  511. __be32 second_crc;
  512. __be16 coded_len;
  513. };
  514. /**
  515. * struct batadv_unicast_tvlv_packet - generic unicast packet with tvlv payload
  516. * @packet_type: batman-adv packet type, part of the general header
  517. * @version: batman-adv protocol version, part of the general header
  518. * @ttl: time to live for this packet, part of the general header
  519. * @reserved: reserved field (for packet alignment)
  520. * @src: address of the source
  521. * @dst: address of the destination
  522. * @tvlv_len: length of tvlv data following the unicast tvlv header
  523. * @align: 2 bytes to align the header to a 4 byte boundary
  524. */
  525. struct batadv_unicast_tvlv_packet {
  526. __u8 packet_type;
  527. __u8 version; /* batman version field */
  528. __u8 ttl;
  529. __u8 reserved;
  530. __u8 dst[ETH_ALEN];
  531. __u8 src[ETH_ALEN];
  532. __be16 tvlv_len;
  533. __u16 align;
  534. };
  535. /**
  536. * struct batadv_tvlv_hdr - base tvlv header struct
  537. * @type: tvlv container type (see batadv_tvlv_type)
  538. * @version: tvlv container version
  539. * @len: tvlv container length
  540. */
  541. struct batadv_tvlv_hdr {
  542. __u8 type;
  543. __u8 version;
  544. __be16 len;
  545. };
  546. /**
  547. * struct batadv_tvlv_gateway_data - gateway data propagated through gw tvlv
  548. * container
  549. * @bandwidth_down: advertised uplink download bandwidth
  550. * @bandwidth_up: advertised uplink upload bandwidth
  551. */
  552. struct batadv_tvlv_gateway_data {
  553. __be32 bandwidth_down;
  554. __be32 bandwidth_up;
  555. };
  556. /**
  557. * struct batadv_tvlv_tt_data - tt data propagated through the tt tvlv container
  558. * @flags: translation table flags (see batadv_tt_data_flags)
  559. * @ttvn: translation table version number
  560. * @num_vlan: number of announced VLANs. In the TVLV this struct is followed by
  561. * one batadv_tvlv_tt_vlan_data object per announced vlan
  562. */
  563. struct batadv_tvlv_tt_data {
  564. __u8 flags;
  565. __u8 ttvn;
  566. __be16 num_vlan;
  567. };
  568. /**
  569. * struct batadv_tvlv_tt_vlan_data - vlan specific tt data propagated through
  570. * the tt tvlv container
  571. * @crc: crc32 checksum of the entries belonging to this vlan
  572. * @vid: vlan identifier
  573. * @reserved: unused, useful for alignment purposes
  574. */
  575. struct batadv_tvlv_tt_vlan_data {
  576. __be32 crc;
  577. __be16 vid;
  578. __u16 reserved;
  579. };
  580. /**
  581. * struct batadv_tvlv_tt_change - translation table diff data
  582. * @flags: status indicators concerning the non-mesh client (see
  583. * batadv_tt_client_flags)
  584. * @reserved: reserved field - useful for alignment purposes only
  585. * @addr: mac address of non-mesh client that triggered this tt change
  586. * @vid: VLAN identifier
  587. */
  588. struct batadv_tvlv_tt_change {
  589. __u8 flags;
  590. __u8 reserved[3];
  591. __u8 addr[ETH_ALEN];
  592. __be16 vid;
  593. };
  594. /**
  595. * struct batadv_tvlv_roam_adv - roaming advertisement
  596. * @client: mac address of roaming client
  597. * @vid: VLAN identifier
  598. */
  599. struct batadv_tvlv_roam_adv {
  600. __u8 client[ETH_ALEN];
  601. __be16 vid;
  602. };
  603. /**
  604. * struct batadv_tvlv_mcast_data - payload of a multicast tvlv
  605. * @flags: multicast flags announced by the orig node
  606. * @reserved: reserved field
  607. */
  608. struct batadv_tvlv_mcast_data {
  609. __u8 flags;
  610. __u8 reserved[3];
  611. };
  612. /**
  613. * struct batadv_tvlv_mcast_tracker - payload of a multicast tracker tvlv
  614. * @num_dests: number of subsequent destination originator MAC addresses
  615. */
  616. struct batadv_tvlv_mcast_tracker {
  617. __be16 num_dests;
  618. };
  619. #pragma pack()
  620. #endif /* _LINUX_BATADV_PACKET_H_ */