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