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