packet.h 19 KB

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