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