273-batman-adv-Convert-packet.h-to-uapi-header.patch 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664
  1. From: Sven Eckelmann <sven.eckelmann@openmesh.com>
  2. Date: Thu, 21 Dec 2017 10:17:41 +0100
  3. Subject: [PATCH] batman-adv: Convert packet.h to uapi header
  4. The header file is used by different userspace programs to inject packets
  5. or to decode sniffed packets. It should therefore be available to them as
  6. userspace header.
  7. Also other components in the kernel (like the flow dissector) require
  8. access to the packet definitions to be able to decode ETH_P_BATMAN ethernet
  9. packets.
  10. Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
  11. Signed-off-by: David S. Miller <davem@davemloft.net>
  12. --- a/MAINTAINERS
  13. +++ b/MAINTAINERS
  14. @@ -2551,6 +2551,7 @@ S: Maintained
  15. F: Documentation/ABI/testing/sysfs-class-net-batman-adv
  16. F: Documentation/ABI/testing/sysfs-class-net-mesh
  17. F: Documentation/networking/batman-adv.rst
  18. +F: include/uapi/linux/batadv_packet.h
  19. F: include/uapi/linux/batman_adv.h
  20. F: net/batman-adv/
  21. --- a/net/batman-adv/bat_iv_ogm.c
  22. +++ b/net/batman-adv/bat_iv_ogm.c
  23. @@ -52,6 +52,7 @@
  24. #include <linux/workqueue.h>
  25. #include <net/genetlink.h>
  26. #include <net/netlink.h>
  27. +#include <uapi/linux/batadv_packet.h>
  28. #include <uapi/linux/batman_adv.h>
  29. #include "bat_algo.h"
  30. @@ -63,7 +64,6 @@
  31. #include "netlink.h"
  32. #include "network-coding.h"
  33. #include "originator.h"
  34. -#include "packet.h"
  35. #include "routing.h"
  36. #include "send.h"
  37. #include "translation-table.h"
  38. --- a/net/batman-adv/bat_v.c
  39. +++ b/net/batman-adv/bat_v.c
  40. @@ -36,6 +36,7 @@
  41. #include <linux/workqueue.h>
  42. #include <net/genetlink.h>
  43. #include <net/netlink.h>
  44. +#include <uapi/linux/batadv_packet.h>
  45. #include <uapi/linux/batman_adv.h>
  46. #include "bat_algo.h"
  47. @@ -48,7 +49,6 @@
  48. #include "log.h"
  49. #include "netlink.h"
  50. #include "originator.h"
  51. -#include "packet.h"
  52. struct sk_buff;
  53. --- a/net/batman-adv/bat_v_elp.c
  54. +++ b/net/batman-adv/bat_v_elp.c
  55. @@ -41,13 +41,13 @@
  56. #include <linux/types.h>
  57. #include <linux/workqueue.h>
  58. #include <net/cfg80211.h>
  59. +#include <uapi/linux/batadv_packet.h>
  60. #include "bat_algo.h"
  61. #include "bat_v_ogm.h"
  62. #include "hard-interface.h"
  63. #include "log.h"
  64. #include "originator.h"
  65. -#include "packet.h"
  66. #include "routing.h"
  67. #include "send.h"
  68. --- a/net/batman-adv/bat_v_ogm.c
  69. +++ b/net/batman-adv/bat_v_ogm.c
  70. @@ -40,13 +40,13 @@
  71. #include <linux/string.h>
  72. #include <linux/types.h>
  73. #include <linux/workqueue.h>
  74. +#include <uapi/linux/batadv_packet.h>
  75. #include "bat_algo.h"
  76. #include "hard-interface.h"
  77. #include "hash.h"
  78. #include "log.h"
  79. #include "originator.h"
  80. -#include "packet.h"
  81. #include "routing.h"
  82. #include "send.h"
  83. #include "translation-table.h"
  84. --- a/net/batman-adv/bridge_loop_avoidance.c
  85. +++ b/net/batman-adv/bridge_loop_avoidance.c
  86. @@ -50,6 +50,7 @@
  87. #include <net/genetlink.h>
  88. #include <net/netlink.h>
  89. #include <net/sock.h>
  90. +#include <uapi/linux/batadv_packet.h>
  91. #include <uapi/linux/batman_adv.h>
  92. #include "hard-interface.h"
  93. @@ -57,7 +58,6 @@
  94. #include "log.h"
  95. #include "netlink.h"
  96. #include "originator.h"
  97. -#include "packet.h"
  98. #include "soft-interface.h"
  99. #include "sysfs.h"
  100. #include "translation-table.h"
  101. --- a/net/batman-adv/distributed-arp-table.h
  102. +++ b/net/batman-adv/distributed-arp-table.h
  103. @@ -23,9 +23,9 @@
  104. #include <linux/compiler.h>
  105. #include <linux/netdevice.h>
  106. #include <linux/types.h>
  107. +#include <uapi/linux/batadv_packet.h>
  108. #include "originator.h"
  109. -#include "packet.h"
  110. struct seq_file;
  111. struct sk_buff;
  112. --- a/net/batman-adv/fragmentation.c
  113. +++ b/net/batman-adv/fragmentation.c
  114. @@ -32,10 +32,10 @@
  115. #include <linux/slab.h>
  116. #include <linux/spinlock.h>
  117. #include <linux/string.h>
  118. +#include <uapi/linux/batadv_packet.h>
  119. #include "hard-interface.h"
  120. #include "originator.h"
  121. -#include "packet.h"
  122. #include "routing.h"
  123. #include "send.h"
  124. #include "soft-interface.h"
  125. --- a/net/batman-adv/gateway_client.c
  126. +++ b/net/batman-adv/gateway_client.c
  127. @@ -43,6 +43,7 @@
  128. #include <linux/stddef.h>
  129. #include <linux/udp.h>
  130. #include <net/sock.h>
  131. +#include <uapi/linux/batadv_packet.h>
  132. #include <uapi/linux/batman_adv.h>
  133. #include "gateway_common.h"
  134. @@ -50,7 +51,6 @@
  135. #include "log.h"
  136. #include "netlink.h"
  137. #include "originator.h"
  138. -#include "packet.h"
  139. #include "routing.h"
  140. #include "soft-interface.h"
  141. #include "sysfs.h"
  142. --- a/net/batman-adv/gateway_common.c
  143. +++ b/net/batman-adv/gateway_common.c
  144. @@ -26,10 +26,10 @@
  145. #include <linux/netdevice.h>
  146. #include <linux/stddef.h>
  147. #include <linux/string.h>
  148. +#include <uapi/linux/batadv_packet.h>
  149. #include "gateway_client.h"
  150. #include "log.h"
  151. -#include "packet.h"
  152. #include "tvlv.h"
  153. /**
  154. --- a/net/batman-adv/hard-interface.c
  155. +++ b/net/batman-adv/hard-interface.c
  156. @@ -37,6 +37,7 @@
  157. #include <linux/spinlock.h>
  158. #include <net/net_namespace.h>
  159. #include <net/rtnetlink.h>
  160. +#include <uapi/linux/batadv_packet.h>
  161. #include "bat_v.h"
  162. #include "bridge_loop_avoidance.h"
  163. @@ -45,7 +46,6 @@
  164. #include "gateway_client.h"
  165. #include "log.h"
  166. #include "originator.h"
  167. -#include "packet.h"
  168. #include "send.h"
  169. #include "soft-interface.h"
  170. #include "sysfs.h"
  171. --- a/net/batman-adv/icmp_socket.c
  172. +++ b/net/batman-adv/icmp_socket.c
  173. @@ -42,11 +42,11 @@
  174. #include <linux/string.h>
  175. #include <linux/uaccess.h>
  176. #include <linux/wait.h>
  177. +#include <uapi/linux/batadv_packet.h>
  178. #include "hard-interface.h"
  179. #include "log.h"
  180. #include "originator.h"
  181. -#include "packet.h"
  182. #include "send.h"
  183. static struct batadv_socket_client *batadv_socket_client_hash[256];
  184. --- a/net/batman-adv/main.c
  185. +++ b/net/batman-adv/main.c
  186. @@ -45,6 +45,7 @@
  187. #include <linux/workqueue.h>
  188. #include <net/dsfield.h>
  189. #include <net/rtnetlink.h>
  190. +#include <uapi/linux/batadv_packet.h>
  191. #include <uapi/linux/batman_adv.h>
  192. #include "bat_algo.h"
  193. @@ -62,7 +63,6 @@
  194. #include "netlink.h"
  195. #include "network-coding.h"
  196. #include "originator.h"
  197. -#include "packet.h"
  198. #include "routing.h"
  199. #include "send.h"
  200. #include "soft-interface.h"
  201. --- a/net/batman-adv/main.h
  202. +++ b/net/batman-adv/main.h
  203. @@ -190,8 +190,8 @@ enum batadv_uev_type {
  204. #include <linux/jiffies.h>
  205. #include <linux/percpu.h>
  206. #include <linux/types.h>
  207. +#include <uapi/linux/batadv_packet.h>
  208. -#include "packet.h"
  209. #include "types.h"
  210. struct net_device;
  211. --- a/net/batman-adv/multicast.c
  212. +++ b/net/batman-adv/multicast.c
  213. @@ -54,12 +54,12 @@
  214. #include <net/if_inet6.h>
  215. #include <net/ip.h>
  216. #include <net/ipv6.h>
  217. +#include <uapi/linux/batadv_packet.h>
  218. #include "bridge_loop_avoidance.h"
  219. #include "hard-interface.h"
  220. #include "hash.h"
  221. #include "log.h"
  222. -#include "packet.h"
  223. #include "send.h"
  224. #include "translation-table.h"
  225. #include "tvlv.h"
  226. --- a/net/batman-adv/netlink.c
  227. +++ b/net/batman-adv/netlink.c
  228. @@ -39,6 +39,7 @@
  229. #include <net/genetlink.h>
  230. #include <net/netlink.h>
  231. #include <net/sock.h>
  232. +#include <uapi/linux/batadv_packet.h>
  233. #include <uapi/linux/batman_adv.h>
  234. #include "bat_algo.h"
  235. @@ -46,7 +47,6 @@
  236. #include "gateway_client.h"
  237. #include "hard-interface.h"
  238. #include "originator.h"
  239. -#include "packet.h"
  240. #include "soft-interface.h"
  241. #include "tp_meter.h"
  242. #include "translation-table.h"
  243. --- a/net/batman-adv/network-coding.c
  244. +++ b/net/batman-adv/network-coding.c
  245. @@ -47,12 +47,12 @@
  246. #include <linux/stddef.h>
  247. #include <linux/string.h>
  248. #include <linux/workqueue.h>
  249. +#include <uapi/linux/batadv_packet.h>
  250. #include "hard-interface.h"
  251. #include "hash.h"
  252. #include "log.h"
  253. #include "originator.h"
  254. -#include "packet.h"
  255. #include "routing.h"
  256. #include "send.h"
  257. #include "tvlv.h"
  258. --- a/net/batman-adv/packet.h
  259. +++ /dev/null
  260. @@ -1,622 +0,0 @@
  261. -/* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors:
  262. - *
  263. - * Marek Lindner, Simon Wunderlich
  264. - *
  265. - * This program is free software; you can redistribute it and/or
  266. - * modify it under the terms of version 2 of the GNU General Public
  267. - * License as published by the Free Software Foundation.
  268. - *
  269. - * This program is distributed in the hope that it will be useful, but
  270. - * WITHOUT ANY WARRANTY; without even the implied warranty of
  271. - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  272. - * General Public License for more details.
  273. - *
  274. - * You should have received a copy of the GNU General Public License
  275. - * along with this program; if not, see <http://www.gnu.org/licenses/>.
  276. - */
  277. -
  278. -#ifndef _NET_BATMAN_ADV_PACKET_H_
  279. -#define _NET_BATMAN_ADV_PACKET_H_
  280. -
  281. -#include <asm/byteorder.h>
  282. -#include <linux/if_ether.h>
  283. -#include <linux/types.h>
  284. -
  285. -#define batadv_tp_is_error(n) ((__u8)(n) > 127 ? 1 : 0)
  286. -
  287. -/**
  288. - * enum batadv_packettype - types for batman-adv encapsulated packets
  289. - * @BATADV_IV_OGM: originator messages for B.A.T.M.A.N. IV
  290. - * @BATADV_BCAST: broadcast packets carrying broadcast payload
  291. - * @BATADV_CODED: network coded packets
  292. - * @BATADV_ELP: echo location packets for B.A.T.M.A.N. V
  293. - * @BATADV_OGM2: originator messages for B.A.T.M.A.N. V
  294. - *
  295. - * @BATADV_UNICAST: unicast packets carrying unicast payload traffic
  296. - * @BATADV_UNICAST_FRAG: unicast packets carrying a fragment of the original
  297. - * payload packet
  298. - * @BATADV_UNICAST_4ADDR: unicast packet including the originator address of
  299. - * the sender
  300. - * @BATADV_ICMP: unicast packet like IP ICMP used for ping or traceroute
  301. - * @BATADV_UNICAST_TVLV: unicast packet carrying TVLV containers
  302. - */
  303. -enum batadv_packettype {
  304. - /* 0x00 - 0x3f: local packets or special rules for handling */
  305. - BATADV_IV_OGM = 0x00,
  306. - BATADV_BCAST = 0x01,
  307. - BATADV_CODED = 0x02,
  308. - BATADV_ELP = 0x03,
  309. - BATADV_OGM2 = 0x04,
  310. - /* 0x40 - 0x7f: unicast */
  311. -#define BATADV_UNICAST_MIN 0x40
  312. - BATADV_UNICAST = 0x40,
  313. - BATADV_UNICAST_FRAG = 0x41,
  314. - BATADV_UNICAST_4ADDR = 0x42,
  315. - BATADV_ICMP = 0x43,
  316. - BATADV_UNICAST_TVLV = 0x44,
  317. -#define BATADV_UNICAST_MAX 0x7f
  318. - /* 0x80 - 0xff: reserved */
  319. -};
  320. -
  321. -/**
  322. - * enum batadv_subtype - packet subtype for unicast4addr
  323. - * @BATADV_P_DATA: user payload
  324. - * @BATADV_P_DAT_DHT_GET: DHT request message
  325. - * @BATADV_P_DAT_DHT_PUT: DHT store message
  326. - * @BATADV_P_DAT_CACHE_REPLY: ARP reply generated by DAT
  327. - */
  328. -enum batadv_subtype {
  329. - BATADV_P_DATA = 0x01,
  330. - BATADV_P_DAT_DHT_GET = 0x02,
  331. - BATADV_P_DAT_DHT_PUT = 0x03,
  332. - BATADV_P_DAT_CACHE_REPLY = 0x04,
  333. -};
  334. -
  335. -/* this file is included by batctl which needs these defines */
  336. -#define BATADV_COMPAT_VERSION 15
  337. -
  338. -/**
  339. - * enum batadv_iv_flags - flags used in B.A.T.M.A.N. IV OGM packets
  340. - * @BATADV_NOT_BEST_NEXT_HOP: flag is set when ogm packet is forwarded and was
  341. - * previously received from someone else than the best neighbor.
  342. - * @BATADV_PRIMARIES_FIRST_HOP: flag unused.
  343. - * @BATADV_DIRECTLINK: flag is for the first hop or if rebroadcasted from a
  344. - * one hop neighbor on the interface where it was originally received.
  345. - */
  346. -enum batadv_iv_flags {
  347. - BATADV_NOT_BEST_NEXT_HOP = 1UL << 0,
  348. - BATADV_PRIMARIES_FIRST_HOP = 1UL << 1,
  349. - BATADV_DIRECTLINK = 1UL << 2,
  350. -};
  351. -
  352. -/* ICMP message types */
  353. -enum batadv_icmp_packettype {
  354. - BATADV_ECHO_REPLY = 0,
  355. - BATADV_DESTINATION_UNREACHABLE = 3,
  356. - BATADV_ECHO_REQUEST = 8,
  357. - BATADV_TTL_EXCEEDED = 11,
  358. - BATADV_PARAMETER_PROBLEM = 12,
  359. - BATADV_TP = 15,
  360. -};
  361. -
  362. -/**
  363. - * enum batadv_mcast_flags - flags for multicast capabilities and settings
  364. - * @BATADV_MCAST_WANT_ALL_UNSNOOPABLES: we want all packets destined for
  365. - * 224.0.0.0/24 or ff02::1
  366. - * @BATADV_MCAST_WANT_ALL_IPV4: we want all IPv4 multicast packets
  367. - * @BATADV_MCAST_WANT_ALL_IPV6: we want all IPv6 multicast packets
  368. - */
  369. -enum batadv_mcast_flags {
  370. - BATADV_MCAST_WANT_ALL_UNSNOOPABLES = 1UL << 0,
  371. - BATADV_MCAST_WANT_ALL_IPV4 = 1UL << 1,
  372. - BATADV_MCAST_WANT_ALL_IPV6 = 1UL << 2,
  373. -};
  374. -
  375. -/* tt data subtypes */
  376. -#define BATADV_TT_DATA_TYPE_MASK 0x0F
  377. -
  378. -/**
  379. - * enum batadv_tt_data_flags - flags for tt data tvlv
  380. - * @BATADV_TT_OGM_DIFF: TT diff propagated through OGM
  381. - * @BATADV_TT_REQUEST: TT request message
  382. - * @BATADV_TT_RESPONSE: TT response message
  383. - * @BATADV_TT_FULL_TABLE: contains full table to replace existing table
  384. - */
  385. -enum batadv_tt_data_flags {
  386. - BATADV_TT_OGM_DIFF = 1UL << 0,
  387. - BATADV_TT_REQUEST = 1UL << 1,
  388. - BATADV_TT_RESPONSE = 1UL << 2,
  389. - BATADV_TT_FULL_TABLE = 1UL << 4,
  390. -};
  391. -
  392. -/**
  393. - * enum batadv_vlan_flags - flags for the four MSB of any vlan ID field
  394. - * @BATADV_VLAN_HAS_TAG: whether the field contains a valid vlan tag or not
  395. - */
  396. -enum batadv_vlan_flags {
  397. - BATADV_VLAN_HAS_TAG = 1UL << 15,
  398. -};
  399. -
  400. -/* claim frame types for the bridge loop avoidance */
  401. -enum batadv_bla_claimframe {
  402. - BATADV_CLAIM_TYPE_CLAIM = 0x00,
  403. - BATADV_CLAIM_TYPE_UNCLAIM = 0x01,
  404. - BATADV_CLAIM_TYPE_ANNOUNCE = 0x02,
  405. - BATADV_CLAIM_TYPE_REQUEST = 0x03,
  406. - BATADV_CLAIM_TYPE_LOOPDETECT = 0x04,
  407. -};
  408. -
  409. -/**
  410. - * enum batadv_tvlv_type - tvlv type definitions
  411. - * @BATADV_TVLV_GW: gateway tvlv
  412. - * @BATADV_TVLV_DAT: distributed arp table tvlv
  413. - * @BATADV_TVLV_NC: network coding tvlv
  414. - * @BATADV_TVLV_TT: translation table tvlv
  415. - * @BATADV_TVLV_ROAM: roaming advertisement tvlv
  416. - * @BATADV_TVLV_MCAST: multicast capability tvlv
  417. - */
  418. -enum batadv_tvlv_type {
  419. - BATADV_TVLV_GW = 0x01,
  420. - BATADV_TVLV_DAT = 0x02,
  421. - BATADV_TVLV_NC = 0x03,
  422. - BATADV_TVLV_TT = 0x04,
  423. - BATADV_TVLV_ROAM = 0x05,
  424. - BATADV_TVLV_MCAST = 0x06,
  425. -};
  426. -
  427. -#pragma pack(2)
  428. -/* the destination hardware field in the ARP frame is used to
  429. - * transport the claim type and the group id
  430. - */
  431. -struct batadv_bla_claim_dst {
  432. - __u8 magic[3]; /* FF:43:05 */
  433. - __u8 type; /* bla_claimframe */
  434. - __be16 group; /* group id */
  435. -};
  436. -
  437. -#pragma pack()
  438. -
  439. -/**
  440. - * struct batadv_ogm_packet - ogm (routing protocol) packet
  441. - * @packet_type: batman-adv packet type, part of the general header
  442. - * @version: batman-adv protocol version, part of the genereal header
  443. - * @ttl: time to live for this packet, part of the genereal header
  444. - * @flags: contains routing relevant flags - see enum batadv_iv_flags
  445. - * @seqno: sequence identification
  446. - * @orig: address of the source node
  447. - * @prev_sender: address of the previous sender
  448. - * @reserved: reserved byte for alignment
  449. - * @tq: transmission quality
  450. - * @tvlv_len: length of tvlv data following the ogm header
  451. - */
  452. -struct batadv_ogm_packet {
  453. - __u8 packet_type;
  454. - __u8 version;
  455. - __u8 ttl;
  456. - __u8 flags;
  457. - __be32 seqno;
  458. - __u8 orig[ETH_ALEN];
  459. - __u8 prev_sender[ETH_ALEN];
  460. - __u8 reserved;
  461. - __u8 tq;
  462. - __be16 tvlv_len;
  463. - /* __packed is not needed as the struct size is divisible by 4,
  464. - * and the largest data type in this struct has a size of 4.
  465. - */
  466. -};
  467. -
  468. -#define BATADV_OGM_HLEN sizeof(struct batadv_ogm_packet)
  469. -
  470. -/**
  471. - * struct batadv_ogm2_packet - ogm2 (routing protocol) packet
  472. - * @packet_type: batman-adv packet type, part of the general header
  473. - * @version: batman-adv protocol version, part of the general header
  474. - * @ttl: time to live for this packet, part of the general header
  475. - * @flags: reseved for routing relevant flags - currently always 0
  476. - * @seqno: sequence number
  477. - * @orig: originator mac address
  478. - * @tvlv_len: length of the appended tvlv buffer (in bytes)
  479. - * @throughput: the currently flooded path throughput
  480. - */
  481. -struct batadv_ogm2_packet {
  482. - __u8 packet_type;
  483. - __u8 version;
  484. - __u8 ttl;
  485. - __u8 flags;
  486. - __be32 seqno;
  487. - __u8 orig[ETH_ALEN];
  488. - __be16 tvlv_len;
  489. - __be32 throughput;
  490. - /* __packed is not needed as the struct size is divisible by 4,
  491. - * and the largest data type in this struct has a size of 4.
  492. - */
  493. -};
  494. -
  495. -#define BATADV_OGM2_HLEN sizeof(struct batadv_ogm2_packet)
  496. -
  497. -/**
  498. - * struct batadv_elp_packet - elp (neighbor discovery) packet
  499. - * @packet_type: batman-adv packet type, part of the general header
  500. - * @version: batman-adv protocol version, part of the genereal header
  501. - * @orig: originator mac address
  502. - * @seqno: sequence number
  503. - * @elp_interval: currently used ELP sending interval in ms
  504. - */
  505. -struct batadv_elp_packet {
  506. - __u8 packet_type;
  507. - __u8 version;
  508. - __u8 orig[ETH_ALEN];
  509. - __be32 seqno;
  510. - __be32 elp_interval;
  511. -};
  512. -
  513. -#define BATADV_ELP_HLEN sizeof(struct batadv_elp_packet)
  514. -
  515. -/**
  516. - * struct batadv_icmp_header - common members among all the ICMP packets
  517. - * @packet_type: batman-adv packet type, part of the general header
  518. - * @version: batman-adv protocol version, part of the genereal header
  519. - * @ttl: time to live for this packet, part of the genereal header
  520. - * @msg_type: ICMP packet type
  521. - * @dst: address of the destination node
  522. - * @orig: address of the source node
  523. - * @uid: local ICMP socket identifier
  524. - * @align: not used - useful for alignment purposes only
  525. - *
  526. - * This structure is used for ICMP packets parsing only and it is never sent
  527. - * over the wire. The alignment field at the end is there to ensure that
  528. - * members are padded the same way as they are in real packets.
  529. - */
  530. -struct batadv_icmp_header {
  531. - __u8 packet_type;
  532. - __u8 version;
  533. - __u8 ttl;
  534. - __u8 msg_type; /* see ICMP message types above */
  535. - __u8 dst[ETH_ALEN];
  536. - __u8 orig[ETH_ALEN];
  537. - __u8 uid;
  538. - __u8 align[3];
  539. -};
  540. -
  541. -/**
  542. - * struct batadv_icmp_packet - ICMP packet
  543. - * @packet_type: batman-adv packet type, part of the general header
  544. - * @version: batman-adv protocol version, part of the genereal header
  545. - * @ttl: time to live for this packet, part of the genereal header
  546. - * @msg_type: ICMP packet type
  547. - * @dst: address of the destination node
  548. - * @orig: address of the source node
  549. - * @uid: local ICMP socket identifier
  550. - * @reserved: not used - useful for alignment
  551. - * @seqno: ICMP sequence number
  552. - */
  553. -struct batadv_icmp_packet {
  554. - __u8 packet_type;
  555. - __u8 version;
  556. - __u8 ttl;
  557. - __u8 msg_type; /* see ICMP message types above */
  558. - __u8 dst[ETH_ALEN];
  559. - __u8 orig[ETH_ALEN];
  560. - __u8 uid;
  561. - __u8 reserved;
  562. - __be16 seqno;
  563. -};
  564. -
  565. -/**
  566. - * struct batadv_icmp_tp_packet - ICMP TP Meter packet
  567. - * @packet_type: batman-adv packet type, part of the general header
  568. - * @version: batman-adv protocol version, part of the genereal header
  569. - * @ttl: time to live for this packet, part of the genereal header
  570. - * @msg_type: ICMP packet type
  571. - * @dst: address of the destination node
  572. - * @orig: address of the source node
  573. - * @uid: local ICMP socket identifier
  574. - * @subtype: TP packet subtype (see batadv_icmp_tp_subtype)
  575. - * @session: TP session identifier
  576. - * @seqno: the TP sequence number
  577. - * @timestamp: time when the packet has been sent. This value is filled in a
  578. - * TP_MSG and echoed back in the next TP_ACK so that the sender can compute the
  579. - * RTT. Since it is read only by the host which wrote it, there is no need to
  580. - * store it using network order
  581. - */
  582. -struct batadv_icmp_tp_packet {
  583. - __u8 packet_type;
  584. - __u8 version;
  585. - __u8 ttl;
  586. - __u8 msg_type; /* see ICMP message types above */
  587. - __u8 dst[ETH_ALEN];
  588. - __u8 orig[ETH_ALEN];
  589. - __u8 uid;
  590. - __u8 subtype;
  591. - __u8 session[2];
  592. - __be32 seqno;
  593. - __be32 timestamp;
  594. -};
  595. -
  596. -/**
  597. - * enum batadv_icmp_tp_subtype - ICMP TP Meter packet subtypes
  598. - * @BATADV_TP_MSG: Msg from sender to receiver
  599. - * @BATADV_TP_ACK: acknowledgment from receiver to sender
  600. - */
  601. -enum batadv_icmp_tp_subtype {
  602. - BATADV_TP_MSG = 0,
  603. - BATADV_TP_ACK,
  604. -};
  605. -
  606. -#define BATADV_RR_LEN 16
  607. -
  608. -/**
  609. - * struct batadv_icmp_packet_rr - ICMP RouteRecord packet
  610. - * @packet_type: batman-adv packet type, part of the general header
  611. - * @version: batman-adv protocol version, part of the genereal header
  612. - * @ttl: time to live for this packet, part of the genereal header
  613. - * @msg_type: ICMP packet type
  614. - * @dst: address of the destination node
  615. - * @orig: address of the source node
  616. - * @uid: local ICMP socket identifier
  617. - * @rr_cur: number of entries the rr array
  618. - * @seqno: ICMP sequence number
  619. - * @rr: route record array
  620. - */
  621. -struct batadv_icmp_packet_rr {
  622. - __u8 packet_type;
  623. - __u8 version;
  624. - __u8 ttl;
  625. - __u8 msg_type; /* see ICMP message types above */
  626. - __u8 dst[ETH_ALEN];
  627. - __u8 orig[ETH_ALEN];
  628. - __u8 uid;
  629. - __u8 rr_cur;
  630. - __be16 seqno;
  631. - __u8 rr[BATADV_RR_LEN][ETH_ALEN];
  632. -};
  633. -
  634. -#define BATADV_ICMP_MAX_PACKET_SIZE sizeof(struct batadv_icmp_packet_rr)
  635. -
  636. -/* All packet headers in front of an ethernet header have to be completely
  637. - * divisible by 2 but not by 4 to make the payload after the ethernet
  638. - * header again 4 bytes boundary aligned.
  639. - *
  640. - * A packing of 2 is necessary to avoid extra padding at the end of the struct
  641. - * caused by a structure member which is larger than two bytes. Otherwise
  642. - * the structure would not fulfill the previously mentioned rule to avoid the
  643. - * misalignment of the payload after the ethernet header. It may also lead to
  644. - * leakage of information when the padding it not initialized before sending.
  645. - */
  646. -#pragma pack(2)
  647. -
  648. -/**
  649. - * struct batadv_unicast_packet - unicast packet for network payload
  650. - * @packet_type: batman-adv packet type, part of the general header
  651. - * @version: batman-adv protocol version, part of the genereal header
  652. - * @ttl: time to live for this packet, part of the genereal header
  653. - * @ttvn: translation table version number
  654. - * @dest: originator destination of the unicast packet
  655. - */
  656. -struct batadv_unicast_packet {
  657. - __u8 packet_type;
  658. - __u8 version;
  659. - __u8 ttl;
  660. - __u8 ttvn; /* destination translation table version number */
  661. - __u8 dest[ETH_ALEN];
  662. - /* "4 bytes boundary + 2 bytes" long to make the payload after the
  663. - * following ethernet header again 4 bytes boundary aligned
  664. - */
  665. -};
  666. -
  667. -/**
  668. - * struct batadv_unicast_4addr_packet - extended unicast packet
  669. - * @u: common unicast packet header
  670. - * @src: address of the source
  671. - * @subtype: packet subtype
  672. - * @reserved: reserved byte for alignment
  673. - */
  674. -struct batadv_unicast_4addr_packet {
  675. - struct batadv_unicast_packet u;
  676. - __u8 src[ETH_ALEN];
  677. - __u8 subtype;
  678. - __u8 reserved;
  679. - /* "4 bytes boundary + 2 bytes" long to make the payload after the
  680. - * following ethernet header again 4 bytes boundary aligned
  681. - */
  682. -};
  683. -
  684. -/**
  685. - * struct batadv_frag_packet - fragmented packet
  686. - * @packet_type: batman-adv packet type, part of the general header
  687. - * @version: batman-adv protocol version, part of the genereal header
  688. - * @ttl: time to live for this packet, part of the genereal header
  689. - * @dest: final destination used when routing fragments
  690. - * @orig: originator of the fragment used when merging the packet
  691. - * @no: fragment number within this sequence
  692. - * @priority: priority of frame, from ToS IP precedence or 802.1p
  693. - * @reserved: reserved byte for alignment
  694. - * @seqno: sequence identification
  695. - * @total_size: size of the merged packet
  696. - */
  697. -struct batadv_frag_packet {
  698. - __u8 packet_type;
  699. - __u8 version; /* batman version field */
  700. - __u8 ttl;
  701. -#if defined(__BIG_ENDIAN_BITFIELD)
  702. - __u8 no:4;
  703. - __u8 priority:3;
  704. - __u8 reserved:1;
  705. -#elif defined(__LITTLE_ENDIAN_BITFIELD)
  706. - __u8 reserved:1;
  707. - __u8 priority:3;
  708. - __u8 no:4;
  709. -#else
  710. -#error "unknown bitfield endianness"
  711. -#endif
  712. - __u8 dest[ETH_ALEN];
  713. - __u8 orig[ETH_ALEN];
  714. - __be16 seqno;
  715. - __be16 total_size;
  716. -};
  717. -
  718. -/**
  719. - * struct batadv_bcast_packet - broadcast packet for network payload
  720. - * @packet_type: batman-adv packet type, part of the general header
  721. - * @version: batman-adv protocol version, part of the genereal header
  722. - * @ttl: time to live for this packet, part of the genereal header
  723. - * @reserved: reserved byte for alignment
  724. - * @seqno: sequence identification
  725. - * @orig: originator of the broadcast packet
  726. - */
  727. -struct batadv_bcast_packet {
  728. - __u8 packet_type;
  729. - __u8 version; /* batman version field */
  730. - __u8 ttl;
  731. - __u8 reserved;
  732. - __be32 seqno;
  733. - __u8 orig[ETH_ALEN];
  734. - /* "4 bytes boundary + 2 bytes" long to make the payload after the
  735. - * following ethernet header again 4 bytes boundary aligned
  736. - */
  737. -};
  738. -
  739. -/**
  740. - * struct batadv_coded_packet - network coded packet
  741. - * @packet_type: batman-adv packet type, part of the general header
  742. - * @version: batman-adv protocol version, part of the genereal header
  743. - * @ttl: time to live for this packet, part of the genereal header
  744. - * @first_source: original source of first included packet
  745. - * @first_orig_dest: original destinal of first included packet
  746. - * @first_crc: checksum of first included packet
  747. - * @first_ttvn: tt-version number of first included packet
  748. - * @second_ttl: ttl of second packet
  749. - * @second_dest: second receiver of this coded packet
  750. - * @second_source: original source of second included packet
  751. - * @second_orig_dest: original destination of second included packet
  752. - * @second_crc: checksum of second included packet
  753. - * @second_ttvn: tt version number of second included packet
  754. - * @coded_len: length of network coded part of the payload
  755. - */
  756. -struct batadv_coded_packet {
  757. - __u8 packet_type;
  758. - __u8 version; /* batman version field */
  759. - __u8 ttl;
  760. - __u8 first_ttvn;
  761. - /* __u8 first_dest[ETH_ALEN]; - saved in mac header destination */
  762. - __u8 first_source[ETH_ALEN];
  763. - __u8 first_orig_dest[ETH_ALEN];
  764. - __be32 first_crc;
  765. - __u8 second_ttl;
  766. - __u8 second_ttvn;
  767. - __u8 second_dest[ETH_ALEN];
  768. - __u8 second_source[ETH_ALEN];
  769. - __u8 second_orig_dest[ETH_ALEN];
  770. - __be32 second_crc;
  771. - __be16 coded_len;
  772. -};
  773. -
  774. -#pragma pack()
  775. -
  776. -/**
  777. - * struct batadv_unicast_tvlv_packet - generic unicast packet with tvlv payload
  778. - * @packet_type: batman-adv packet type, part of the general header
  779. - * @version: batman-adv protocol version, part of the genereal header
  780. - * @ttl: time to live for this packet, part of the genereal header
  781. - * @reserved: reserved field (for packet alignment)
  782. - * @src: address of the source
  783. - * @dst: address of the destination
  784. - * @tvlv_len: length of tvlv data following the unicast tvlv header
  785. - * @align: 2 bytes to align the header to a 4 byte boundary
  786. - */
  787. -struct batadv_unicast_tvlv_packet {
  788. - __u8 packet_type;
  789. - __u8 version; /* batman version field */
  790. - __u8 ttl;
  791. - __u8 reserved;
  792. - __u8 dst[ETH_ALEN];
  793. - __u8 src[ETH_ALEN];
  794. - __be16 tvlv_len;
  795. - __u16 align;
  796. -};
  797. -
  798. -/**
  799. - * struct batadv_tvlv_hdr - base tvlv header struct
  800. - * @type: tvlv container type (see batadv_tvlv_type)
  801. - * @version: tvlv container version
  802. - * @len: tvlv container length
  803. - */
  804. -struct batadv_tvlv_hdr {
  805. - __u8 type;
  806. - __u8 version;
  807. - __be16 len;
  808. -};
  809. -
  810. -/**
  811. - * struct batadv_tvlv_gateway_data - gateway data propagated through gw tvlv
  812. - * container
  813. - * @bandwidth_down: advertised uplink download bandwidth
  814. - * @bandwidth_up: advertised uplink upload bandwidth
  815. - */
  816. -struct batadv_tvlv_gateway_data {
  817. - __be32 bandwidth_down;
  818. - __be32 bandwidth_up;
  819. -};
  820. -
  821. -/**
  822. - * struct batadv_tvlv_tt_data - tt data propagated through the tt tvlv container
  823. - * @flags: translation table flags (see batadv_tt_data_flags)
  824. - * @ttvn: translation table version number
  825. - * @num_vlan: number of announced VLANs. In the TVLV this struct is followed by
  826. - * one batadv_tvlv_tt_vlan_data object per announced vlan
  827. - */
  828. -struct batadv_tvlv_tt_data {
  829. - __u8 flags;
  830. - __u8 ttvn;
  831. - __be16 num_vlan;
  832. -};
  833. -
  834. -/**
  835. - * struct batadv_tvlv_tt_vlan_data - vlan specific tt data propagated through
  836. - * the tt tvlv container
  837. - * @crc: crc32 checksum of the entries belonging to this vlan
  838. - * @vid: vlan identifier
  839. - * @reserved: unused, useful for alignment purposes
  840. - */
  841. -struct batadv_tvlv_tt_vlan_data {
  842. - __be32 crc;
  843. - __be16 vid;
  844. - __u16 reserved;
  845. -};
  846. -
  847. -/**
  848. - * struct batadv_tvlv_tt_change - translation table diff data
  849. - * @flags: status indicators concerning the non-mesh client (see
  850. - * batadv_tt_client_flags)
  851. - * @reserved: reserved field - useful for alignment purposes only
  852. - * @addr: mac address of non-mesh client that triggered this tt change
  853. - * @vid: VLAN identifier
  854. - */
  855. -struct batadv_tvlv_tt_change {
  856. - __u8 flags;
  857. - __u8 reserved[3];
  858. - __u8 addr[ETH_ALEN];
  859. - __be16 vid;
  860. -};
  861. -
  862. -/**
  863. - * struct batadv_tvlv_roam_adv - roaming advertisement
  864. - * @client: mac address of roaming client
  865. - * @vid: VLAN identifier
  866. - */
  867. -struct batadv_tvlv_roam_adv {
  868. - __u8 client[ETH_ALEN];
  869. - __be16 vid;
  870. -};
  871. -
  872. -/**
  873. - * struct batadv_tvlv_mcast_data - payload of a multicast tvlv
  874. - * @flags: multicast flags announced by the orig node
  875. - * @reserved: reserved field
  876. - */
  877. -struct batadv_tvlv_mcast_data {
  878. - __u8 flags;
  879. - __u8 reserved[3];
  880. -};
  881. -
  882. -#endif /* _NET_BATMAN_ADV_PACKET_H_ */
  883. --- a/net/batman-adv/routing.c
  884. +++ b/net/batman-adv/routing.c
  885. @@ -33,6 +33,7 @@
  886. #include <linux/skbuff.h>
  887. #include <linux/spinlock.h>
  888. #include <linux/stddef.h>
  889. +#include <uapi/linux/batadv_packet.h>
  890. #include "bitarray.h"
  891. #include "bridge_loop_avoidance.h"
  892. @@ -43,7 +44,6 @@
  893. #include "log.h"
  894. #include "network-coding.h"
  895. #include "originator.h"
  896. -#include "packet.h"
  897. #include "send.h"
  898. #include "soft-interface.h"
  899. #include "tp_meter.h"
  900. --- a/net/batman-adv/send.h
  901. +++ b/net/batman-adv/send.h
  902. @@ -23,8 +23,7 @@
  903. #include <linux/compiler.h>
  904. #include <linux/spinlock.h>
  905. #include <linux/types.h>
  906. -
  907. -#include "packet.h"
  908. +#include <uapi/linux/batadv_packet.h>
  909. struct sk_buff;
  910. --- a/net/batman-adv/soft-interface.c
  911. +++ b/net/batman-adv/soft-interface.c
  912. @@ -48,6 +48,7 @@
  913. #include <linux/stddef.h>
  914. #include <linux/string.h>
  915. #include <linux/types.h>
  916. +#include <uapi/linux/batadv_packet.h>
  917. #include "bat_algo.h"
  918. #include "bridge_loop_avoidance.h"
  919. @@ -59,7 +60,6 @@
  920. #include "multicast.h"
  921. #include "network-coding.h"
  922. #include "originator.h"
  923. -#include "packet.h"
  924. #include "send.h"
  925. #include "sysfs.h"
  926. #include "translation-table.h"
  927. --- a/net/batman-adv/sysfs.c
  928. +++ b/net/batman-adv/sysfs.c
  929. @@ -37,6 +37,7 @@
  930. #include <linux/string.h>
  931. #include <linux/stringify.h>
  932. #include <linux/workqueue.h>
  933. +#include <uapi/linux/batadv_packet.h>
  934. #include "bridge_loop_avoidance.h"
  935. #include "distributed-arp-table.h"
  936. @@ -45,7 +46,6 @@
  937. #include "hard-interface.h"
  938. #include "log.h"
  939. #include "network-coding.h"
  940. -#include "packet.h"
  941. #include "soft-interface.h"
  942. static struct net_device *batadv_kobj_to_netdev(struct kobject *obj)
  943. --- a/net/batman-adv/tp_meter.c
  944. +++ b/net/batman-adv/tp_meter.c
  945. @@ -48,13 +48,13 @@
  946. #include <linux/timer.h>
  947. #include <linux/wait.h>
  948. #include <linux/workqueue.h>
  949. +#include <uapi/linux/batadv_packet.h>
  950. #include <uapi/linux/batman_adv.h>
  951. #include "hard-interface.h"
  952. #include "log.h"
  953. #include "netlink.h"
  954. #include "originator.h"
  955. -#include "packet.h"
  956. #include "send.h"
  957. /**
  958. --- a/net/batman-adv/translation-table.c
  959. +++ b/net/batman-adv/translation-table.c
  960. @@ -50,6 +50,7 @@
  961. #include <net/genetlink.h>
  962. #include <net/netlink.h>
  963. #include <net/sock.h>
  964. +#include <uapi/linux/batadv_packet.h>
  965. #include <uapi/linux/batman_adv.h>
  966. #include "bridge_loop_avoidance.h"
  967. @@ -58,7 +59,6 @@
  968. #include "log.h"
  969. #include "netlink.h"
  970. #include "originator.h"
  971. -#include "packet.h"
  972. #include "soft-interface.h"
  973. #include "tvlv.h"
  974. --- a/net/batman-adv/tvlv.c
  975. +++ b/net/batman-adv/tvlv.c
  976. @@ -35,9 +35,9 @@
  977. #include <linux/stddef.h>
  978. #include <linux/string.h>
  979. #include <linux/types.h>
  980. +#include <uapi/linux/batadv_packet.h>
  981. #include "originator.h"
  982. -#include "packet.h"
  983. #include "send.h"
  984. #include "tvlv.h"
  985. --- a/net/batman-adv/types.h
  986. +++ b/net/batman-adv/types.h
  987. @@ -35,10 +35,9 @@
  988. #include <linux/types.h>
  989. #include <linux/wait.h>
  990. #include <linux/workqueue.h>
  991. +#include <uapi/linux/batadv_packet.h>
  992. #include <uapi/linux/batman_adv.h>
  993. -#include "packet.h"
  994. -
  995. struct seq_file;
  996. #ifdef CONFIG_BATMAN_ADV_DAT
  997. --- /dev/null
  998. +++ b/include/uapi/linux/batadv_packet.h
  999. @@ -0,0 +1,623 @@
  1000. +/* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) */
  1001. +/* Copyright (C) 2007-2017 B.A.T.M.A.N. contributors:
  1002. + *
  1003. + * Marek Lindner, Simon Wunderlich
  1004. + *
  1005. + * This program is free software; you can redistribute it and/or
  1006. + * modify it under the terms of version 2 of the GNU General Public
  1007. + * License as published by the Free Software Foundation.
  1008. + *
  1009. + * This program is distributed in the hope that it will be useful, but
  1010. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  1011. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  1012. + * General Public License for more details.
  1013. + *
  1014. + * You should have received a copy of the GNU General Public License
  1015. + * along with this program; if not, see <http://www.gnu.org/licenses/>.
  1016. + */
  1017. +
  1018. +#ifndef _UAPI_LINUX_BATADV_PACKET_H_
  1019. +#define _UAPI_LINUX_BATADV_PACKET_H_
  1020. +
  1021. +#include <asm/byteorder.h>
  1022. +#include <linux/if_ether.h>
  1023. +#include <linux/types.h>
  1024. +
  1025. +#define batadv_tp_is_error(n) ((__u8)(n) > 127 ? 1 : 0)
  1026. +
  1027. +/**
  1028. + * enum batadv_packettype - types for batman-adv encapsulated packets
  1029. + * @BATADV_IV_OGM: originator messages for B.A.T.M.A.N. IV
  1030. + * @BATADV_BCAST: broadcast packets carrying broadcast payload
  1031. + * @BATADV_CODED: network coded packets
  1032. + * @BATADV_ELP: echo location packets for B.A.T.M.A.N. V
  1033. + * @BATADV_OGM2: originator messages for B.A.T.M.A.N. V
  1034. + *
  1035. + * @BATADV_UNICAST: unicast packets carrying unicast payload traffic
  1036. + * @BATADV_UNICAST_FRAG: unicast packets carrying a fragment of the original
  1037. + * payload packet
  1038. + * @BATADV_UNICAST_4ADDR: unicast packet including the originator address of
  1039. + * the sender
  1040. + * @BATADV_ICMP: unicast packet like IP ICMP used for ping or traceroute
  1041. + * @BATADV_UNICAST_TVLV: unicast packet carrying TVLV containers
  1042. + */
  1043. +enum batadv_packettype {
  1044. + /* 0x00 - 0x3f: local packets or special rules for handling */
  1045. + BATADV_IV_OGM = 0x00,
  1046. + BATADV_BCAST = 0x01,
  1047. + BATADV_CODED = 0x02,
  1048. + BATADV_ELP = 0x03,
  1049. + BATADV_OGM2 = 0x04,
  1050. + /* 0x40 - 0x7f: unicast */
  1051. +#define BATADV_UNICAST_MIN 0x40
  1052. + BATADV_UNICAST = 0x40,
  1053. + BATADV_UNICAST_FRAG = 0x41,
  1054. + BATADV_UNICAST_4ADDR = 0x42,
  1055. + BATADV_ICMP = 0x43,
  1056. + BATADV_UNICAST_TVLV = 0x44,
  1057. +#define BATADV_UNICAST_MAX 0x7f
  1058. + /* 0x80 - 0xff: reserved */
  1059. +};
  1060. +
  1061. +/**
  1062. + * enum batadv_subtype - packet subtype for unicast4addr
  1063. + * @BATADV_P_DATA: user payload
  1064. + * @BATADV_P_DAT_DHT_GET: DHT request message
  1065. + * @BATADV_P_DAT_DHT_PUT: DHT store message
  1066. + * @BATADV_P_DAT_CACHE_REPLY: ARP reply generated by DAT
  1067. + */
  1068. +enum batadv_subtype {
  1069. + BATADV_P_DATA = 0x01,
  1070. + BATADV_P_DAT_DHT_GET = 0x02,
  1071. + BATADV_P_DAT_DHT_PUT = 0x03,
  1072. + BATADV_P_DAT_CACHE_REPLY = 0x04,
  1073. +};
  1074. +
  1075. +/* this file is included by batctl which needs these defines */
  1076. +#define BATADV_COMPAT_VERSION 15
  1077. +
  1078. +/**
  1079. + * enum batadv_iv_flags - flags used in B.A.T.M.A.N. IV OGM packets
  1080. + * @BATADV_NOT_BEST_NEXT_HOP: flag is set when ogm packet is forwarded and was
  1081. + * previously received from someone else than the best neighbor.
  1082. + * @BATADV_PRIMARIES_FIRST_HOP: flag unused.
  1083. + * @BATADV_DIRECTLINK: flag is for the first hop or if rebroadcasted from a
  1084. + * one hop neighbor on the interface where it was originally received.
  1085. + */
  1086. +enum batadv_iv_flags {
  1087. + BATADV_NOT_BEST_NEXT_HOP = 1UL << 0,
  1088. + BATADV_PRIMARIES_FIRST_HOP = 1UL << 1,
  1089. + BATADV_DIRECTLINK = 1UL << 2,
  1090. +};
  1091. +
  1092. +/* ICMP message types */
  1093. +enum batadv_icmp_packettype {
  1094. + BATADV_ECHO_REPLY = 0,
  1095. + BATADV_DESTINATION_UNREACHABLE = 3,
  1096. + BATADV_ECHO_REQUEST = 8,
  1097. + BATADV_TTL_EXCEEDED = 11,
  1098. + BATADV_PARAMETER_PROBLEM = 12,
  1099. + BATADV_TP = 15,
  1100. +};
  1101. +
  1102. +/**
  1103. + * enum batadv_mcast_flags - flags for multicast capabilities and settings
  1104. + * @BATADV_MCAST_WANT_ALL_UNSNOOPABLES: we want all packets destined for
  1105. + * 224.0.0.0/24 or ff02::1
  1106. + * @BATADV_MCAST_WANT_ALL_IPV4: we want all IPv4 multicast packets
  1107. + * @BATADV_MCAST_WANT_ALL_IPV6: we want all IPv6 multicast packets
  1108. + */
  1109. +enum batadv_mcast_flags {
  1110. + BATADV_MCAST_WANT_ALL_UNSNOOPABLES = 1UL << 0,
  1111. + BATADV_MCAST_WANT_ALL_IPV4 = 1UL << 1,
  1112. + BATADV_MCAST_WANT_ALL_IPV6 = 1UL << 2,
  1113. +};
  1114. +
  1115. +/* tt data subtypes */
  1116. +#define BATADV_TT_DATA_TYPE_MASK 0x0F
  1117. +
  1118. +/**
  1119. + * enum batadv_tt_data_flags - flags for tt data tvlv
  1120. + * @BATADV_TT_OGM_DIFF: TT diff propagated through OGM
  1121. + * @BATADV_TT_REQUEST: TT request message
  1122. + * @BATADV_TT_RESPONSE: TT response message
  1123. + * @BATADV_TT_FULL_TABLE: contains full table to replace existing table
  1124. + */
  1125. +enum batadv_tt_data_flags {
  1126. + BATADV_TT_OGM_DIFF = 1UL << 0,
  1127. + BATADV_TT_REQUEST = 1UL << 1,
  1128. + BATADV_TT_RESPONSE = 1UL << 2,
  1129. + BATADV_TT_FULL_TABLE = 1UL << 4,
  1130. +};
  1131. +
  1132. +/**
  1133. + * enum batadv_vlan_flags - flags for the four MSB of any vlan ID field
  1134. + * @BATADV_VLAN_HAS_TAG: whether the field contains a valid vlan tag or not
  1135. + */
  1136. +enum batadv_vlan_flags {
  1137. + BATADV_VLAN_HAS_TAG = 1UL << 15,
  1138. +};
  1139. +
  1140. +/* claim frame types for the bridge loop avoidance */
  1141. +enum batadv_bla_claimframe {
  1142. + BATADV_CLAIM_TYPE_CLAIM = 0x00,
  1143. + BATADV_CLAIM_TYPE_UNCLAIM = 0x01,
  1144. + BATADV_CLAIM_TYPE_ANNOUNCE = 0x02,
  1145. + BATADV_CLAIM_TYPE_REQUEST = 0x03,
  1146. + BATADV_CLAIM_TYPE_LOOPDETECT = 0x04,
  1147. +};
  1148. +
  1149. +/**
  1150. + * enum batadv_tvlv_type - tvlv type definitions
  1151. + * @BATADV_TVLV_GW: gateway tvlv
  1152. + * @BATADV_TVLV_DAT: distributed arp table tvlv
  1153. + * @BATADV_TVLV_NC: network coding tvlv
  1154. + * @BATADV_TVLV_TT: translation table tvlv
  1155. + * @BATADV_TVLV_ROAM: roaming advertisement tvlv
  1156. + * @BATADV_TVLV_MCAST: multicast capability tvlv
  1157. + */
  1158. +enum batadv_tvlv_type {
  1159. + BATADV_TVLV_GW = 0x01,
  1160. + BATADV_TVLV_DAT = 0x02,
  1161. + BATADV_TVLV_NC = 0x03,
  1162. + BATADV_TVLV_TT = 0x04,
  1163. + BATADV_TVLV_ROAM = 0x05,
  1164. + BATADV_TVLV_MCAST = 0x06,
  1165. +};
  1166. +
  1167. +#pragma pack(2)
  1168. +/* the destination hardware field in the ARP frame is used to
  1169. + * transport the claim type and the group id
  1170. + */
  1171. +struct batadv_bla_claim_dst {
  1172. + __u8 magic[3]; /* FF:43:05 */
  1173. + __u8 type; /* bla_claimframe */
  1174. + __be16 group; /* group id */
  1175. +};
  1176. +
  1177. +#pragma pack()
  1178. +
  1179. +/**
  1180. + * struct batadv_ogm_packet - ogm (routing protocol) packet
  1181. + * @packet_type: batman-adv packet type, part of the general header
  1182. + * @version: batman-adv protocol version, part of the genereal header
  1183. + * @ttl: time to live for this packet, part of the genereal header
  1184. + * @flags: contains routing relevant flags - see enum batadv_iv_flags
  1185. + * @seqno: sequence identification
  1186. + * @orig: address of the source node
  1187. + * @prev_sender: address of the previous sender
  1188. + * @reserved: reserved byte for alignment
  1189. + * @tq: transmission quality
  1190. + * @tvlv_len: length of tvlv data following the ogm header
  1191. + */
  1192. +struct batadv_ogm_packet {
  1193. + __u8 packet_type;
  1194. + __u8 version;
  1195. + __u8 ttl;
  1196. + __u8 flags;
  1197. + __be32 seqno;
  1198. + __u8 orig[ETH_ALEN];
  1199. + __u8 prev_sender[ETH_ALEN];
  1200. + __u8 reserved;
  1201. + __u8 tq;
  1202. + __be16 tvlv_len;
  1203. + /* __packed is not needed as the struct size is divisible by 4,
  1204. + * and the largest data type in this struct has a size of 4.
  1205. + */
  1206. +};
  1207. +
  1208. +#define BATADV_OGM_HLEN sizeof(struct batadv_ogm_packet)
  1209. +
  1210. +/**
  1211. + * struct batadv_ogm2_packet - ogm2 (routing protocol) packet
  1212. + * @packet_type: batman-adv packet type, part of the general header
  1213. + * @version: batman-adv protocol version, part of the general header
  1214. + * @ttl: time to live for this packet, part of the general header
  1215. + * @flags: reseved for routing relevant flags - currently always 0
  1216. + * @seqno: sequence number
  1217. + * @orig: originator mac address
  1218. + * @tvlv_len: length of the appended tvlv buffer (in bytes)
  1219. + * @throughput: the currently flooded path throughput
  1220. + */
  1221. +struct batadv_ogm2_packet {
  1222. + __u8 packet_type;
  1223. + __u8 version;
  1224. + __u8 ttl;
  1225. + __u8 flags;
  1226. + __be32 seqno;
  1227. + __u8 orig[ETH_ALEN];
  1228. + __be16 tvlv_len;
  1229. + __be32 throughput;
  1230. + /* __packed is not needed as the struct size is divisible by 4,
  1231. + * and the largest data type in this struct has a size of 4.
  1232. + */
  1233. +};
  1234. +
  1235. +#define BATADV_OGM2_HLEN sizeof(struct batadv_ogm2_packet)
  1236. +
  1237. +/**
  1238. + * struct batadv_elp_packet - elp (neighbor discovery) packet
  1239. + * @packet_type: batman-adv packet type, part of the general header
  1240. + * @version: batman-adv protocol version, part of the genereal header
  1241. + * @orig: originator mac address
  1242. + * @seqno: sequence number
  1243. + * @elp_interval: currently used ELP sending interval in ms
  1244. + */
  1245. +struct batadv_elp_packet {
  1246. + __u8 packet_type;
  1247. + __u8 version;
  1248. + __u8 orig[ETH_ALEN];
  1249. + __be32 seqno;
  1250. + __be32 elp_interval;
  1251. +};
  1252. +
  1253. +#define BATADV_ELP_HLEN sizeof(struct batadv_elp_packet)
  1254. +
  1255. +/**
  1256. + * struct batadv_icmp_header - common members among all the ICMP packets
  1257. + * @packet_type: batman-adv packet type, part of the general header
  1258. + * @version: batman-adv protocol version, part of the genereal header
  1259. + * @ttl: time to live for this packet, part of the genereal header
  1260. + * @msg_type: ICMP packet type
  1261. + * @dst: address of the destination node
  1262. + * @orig: address of the source node
  1263. + * @uid: local ICMP socket identifier
  1264. + * @align: not used - useful for alignment purposes only
  1265. + *
  1266. + * This structure is used for ICMP packets parsing only and it is never sent
  1267. + * over the wire. The alignment field at the end is there to ensure that
  1268. + * members are padded the same way as they are in real packets.
  1269. + */
  1270. +struct batadv_icmp_header {
  1271. + __u8 packet_type;
  1272. + __u8 version;
  1273. + __u8 ttl;
  1274. + __u8 msg_type; /* see ICMP message types above */
  1275. + __u8 dst[ETH_ALEN];
  1276. + __u8 orig[ETH_ALEN];
  1277. + __u8 uid;
  1278. + __u8 align[3];
  1279. +};
  1280. +
  1281. +/**
  1282. + * struct batadv_icmp_packet - ICMP packet
  1283. + * @packet_type: batman-adv packet type, part of the general header
  1284. + * @version: batman-adv protocol version, part of the genereal header
  1285. + * @ttl: time to live for this packet, part of the genereal header
  1286. + * @msg_type: ICMP packet type
  1287. + * @dst: address of the destination node
  1288. + * @orig: address of the source node
  1289. + * @uid: local ICMP socket identifier
  1290. + * @reserved: not used - useful for alignment
  1291. + * @seqno: ICMP sequence number
  1292. + */
  1293. +struct batadv_icmp_packet {
  1294. + __u8 packet_type;
  1295. + __u8 version;
  1296. + __u8 ttl;
  1297. + __u8 msg_type; /* see ICMP message types above */
  1298. + __u8 dst[ETH_ALEN];
  1299. + __u8 orig[ETH_ALEN];
  1300. + __u8 uid;
  1301. + __u8 reserved;
  1302. + __be16 seqno;
  1303. +};
  1304. +
  1305. +/**
  1306. + * struct batadv_icmp_tp_packet - ICMP TP Meter packet
  1307. + * @packet_type: batman-adv packet type, part of the general header
  1308. + * @version: batman-adv protocol version, part of the genereal header
  1309. + * @ttl: time to live for this packet, part of the genereal header
  1310. + * @msg_type: ICMP packet type
  1311. + * @dst: address of the destination node
  1312. + * @orig: address of the source node
  1313. + * @uid: local ICMP socket identifier
  1314. + * @subtype: TP packet subtype (see batadv_icmp_tp_subtype)
  1315. + * @session: TP session identifier
  1316. + * @seqno: the TP sequence number
  1317. + * @timestamp: time when the packet has been sent. This value is filled in a
  1318. + * TP_MSG and echoed back in the next TP_ACK so that the sender can compute the
  1319. + * RTT. Since it is read only by the host which wrote it, there is no need to
  1320. + * store it using network order
  1321. + */
  1322. +struct batadv_icmp_tp_packet {
  1323. + __u8 packet_type;
  1324. + __u8 version;
  1325. + __u8 ttl;
  1326. + __u8 msg_type; /* see ICMP message types above */
  1327. + __u8 dst[ETH_ALEN];
  1328. + __u8 orig[ETH_ALEN];
  1329. + __u8 uid;
  1330. + __u8 subtype;
  1331. + __u8 session[2];
  1332. + __be32 seqno;
  1333. + __be32 timestamp;
  1334. +};
  1335. +
  1336. +/**
  1337. + * enum batadv_icmp_tp_subtype - ICMP TP Meter packet subtypes
  1338. + * @BATADV_TP_MSG: Msg from sender to receiver
  1339. + * @BATADV_TP_ACK: acknowledgment from receiver to sender
  1340. + */
  1341. +enum batadv_icmp_tp_subtype {
  1342. + BATADV_TP_MSG = 0,
  1343. + BATADV_TP_ACK,
  1344. +};
  1345. +
  1346. +#define BATADV_RR_LEN 16
  1347. +
  1348. +/**
  1349. + * struct batadv_icmp_packet_rr - ICMP RouteRecord packet
  1350. + * @packet_type: batman-adv packet type, part of the general header
  1351. + * @version: batman-adv protocol version, part of the genereal header
  1352. + * @ttl: time to live for this packet, part of the genereal header
  1353. + * @msg_type: ICMP packet type
  1354. + * @dst: address of the destination node
  1355. + * @orig: address of the source node
  1356. + * @uid: local ICMP socket identifier
  1357. + * @rr_cur: number of entries the rr array
  1358. + * @seqno: ICMP sequence number
  1359. + * @rr: route record array
  1360. + */
  1361. +struct batadv_icmp_packet_rr {
  1362. + __u8 packet_type;
  1363. + __u8 version;
  1364. + __u8 ttl;
  1365. + __u8 msg_type; /* see ICMP message types above */
  1366. + __u8 dst[ETH_ALEN];
  1367. + __u8 orig[ETH_ALEN];
  1368. + __u8 uid;
  1369. + __u8 rr_cur;
  1370. + __be16 seqno;
  1371. + __u8 rr[BATADV_RR_LEN][ETH_ALEN];
  1372. +};
  1373. +
  1374. +#define BATADV_ICMP_MAX_PACKET_SIZE sizeof(struct batadv_icmp_packet_rr)
  1375. +
  1376. +/* All packet headers in front of an ethernet header have to be completely
  1377. + * divisible by 2 but not by 4 to make the payload after the ethernet
  1378. + * header again 4 bytes boundary aligned.
  1379. + *
  1380. + * A packing of 2 is necessary to avoid extra padding at the end of the struct
  1381. + * caused by a structure member which is larger than two bytes. Otherwise
  1382. + * the structure would not fulfill the previously mentioned rule to avoid the
  1383. + * misalignment of the payload after the ethernet header. It may also lead to
  1384. + * leakage of information when the padding it not initialized before sending.
  1385. + */
  1386. +#pragma pack(2)
  1387. +
  1388. +/**
  1389. + * struct batadv_unicast_packet - unicast packet for network payload
  1390. + * @packet_type: batman-adv packet type, part of the general header
  1391. + * @version: batman-adv protocol version, part of the genereal header
  1392. + * @ttl: time to live for this packet, part of the genereal header
  1393. + * @ttvn: translation table version number
  1394. + * @dest: originator destination of the unicast packet
  1395. + */
  1396. +struct batadv_unicast_packet {
  1397. + __u8 packet_type;
  1398. + __u8 version;
  1399. + __u8 ttl;
  1400. + __u8 ttvn; /* destination translation table version number */
  1401. + __u8 dest[ETH_ALEN];
  1402. + /* "4 bytes boundary + 2 bytes" long to make the payload after the
  1403. + * following ethernet header again 4 bytes boundary aligned
  1404. + */
  1405. +};
  1406. +
  1407. +/**
  1408. + * struct batadv_unicast_4addr_packet - extended unicast packet
  1409. + * @u: common unicast packet header
  1410. + * @src: address of the source
  1411. + * @subtype: packet subtype
  1412. + * @reserved: reserved byte for alignment
  1413. + */
  1414. +struct batadv_unicast_4addr_packet {
  1415. + struct batadv_unicast_packet u;
  1416. + __u8 src[ETH_ALEN];
  1417. + __u8 subtype;
  1418. + __u8 reserved;
  1419. + /* "4 bytes boundary + 2 bytes" long to make the payload after the
  1420. + * following ethernet header again 4 bytes boundary aligned
  1421. + */
  1422. +};
  1423. +
  1424. +/**
  1425. + * struct batadv_frag_packet - fragmented packet
  1426. + * @packet_type: batman-adv packet type, part of the general header
  1427. + * @version: batman-adv protocol version, part of the genereal header
  1428. + * @ttl: time to live for this packet, part of the genereal header
  1429. + * @dest: final destination used when routing fragments
  1430. + * @orig: originator of the fragment used when merging the packet
  1431. + * @no: fragment number within this sequence
  1432. + * @priority: priority of frame, from ToS IP precedence or 802.1p
  1433. + * @reserved: reserved byte for alignment
  1434. + * @seqno: sequence identification
  1435. + * @total_size: size of the merged packet
  1436. + */
  1437. +struct batadv_frag_packet {
  1438. + __u8 packet_type;
  1439. + __u8 version; /* batman version field */
  1440. + __u8 ttl;
  1441. +#if defined(__BIG_ENDIAN_BITFIELD)
  1442. + __u8 no:4;
  1443. + __u8 priority:3;
  1444. + __u8 reserved:1;
  1445. +#elif defined(__LITTLE_ENDIAN_BITFIELD)
  1446. + __u8 reserved:1;
  1447. + __u8 priority:3;
  1448. + __u8 no:4;
  1449. +#else
  1450. +#error "unknown bitfield endianness"
  1451. +#endif
  1452. + __u8 dest[ETH_ALEN];
  1453. + __u8 orig[ETH_ALEN];
  1454. + __be16 seqno;
  1455. + __be16 total_size;
  1456. +};
  1457. +
  1458. +/**
  1459. + * struct batadv_bcast_packet - broadcast packet for network payload
  1460. + * @packet_type: batman-adv packet type, part of the general header
  1461. + * @version: batman-adv protocol version, part of the genereal header
  1462. + * @ttl: time to live for this packet, part of the genereal header
  1463. + * @reserved: reserved byte for alignment
  1464. + * @seqno: sequence identification
  1465. + * @orig: originator of the broadcast packet
  1466. + */
  1467. +struct batadv_bcast_packet {
  1468. + __u8 packet_type;
  1469. + __u8 version; /* batman version field */
  1470. + __u8 ttl;
  1471. + __u8 reserved;
  1472. + __be32 seqno;
  1473. + __u8 orig[ETH_ALEN];
  1474. + /* "4 bytes boundary + 2 bytes" long to make the payload after the
  1475. + * following ethernet header again 4 bytes boundary aligned
  1476. + */
  1477. +};
  1478. +
  1479. +/**
  1480. + * struct batadv_coded_packet - network coded packet
  1481. + * @packet_type: batman-adv packet type, part of the general header
  1482. + * @version: batman-adv protocol version, part of the genereal header
  1483. + * @ttl: time to live for this packet, part of the genereal header
  1484. + * @first_source: original source of first included packet
  1485. + * @first_orig_dest: original destinal of first included packet
  1486. + * @first_crc: checksum of first included packet
  1487. + * @first_ttvn: tt-version number of first included packet
  1488. + * @second_ttl: ttl of second packet
  1489. + * @second_dest: second receiver of this coded packet
  1490. + * @second_source: original source of second included packet
  1491. + * @second_orig_dest: original destination of second included packet
  1492. + * @second_crc: checksum of second included packet
  1493. + * @second_ttvn: tt version number of second included packet
  1494. + * @coded_len: length of network coded part of the payload
  1495. + */
  1496. +struct batadv_coded_packet {
  1497. + __u8 packet_type;
  1498. + __u8 version; /* batman version field */
  1499. + __u8 ttl;
  1500. + __u8 first_ttvn;
  1501. + /* __u8 first_dest[ETH_ALEN]; - saved in mac header destination */
  1502. + __u8 first_source[ETH_ALEN];
  1503. + __u8 first_orig_dest[ETH_ALEN];
  1504. + __be32 first_crc;
  1505. + __u8 second_ttl;
  1506. + __u8 second_ttvn;
  1507. + __u8 second_dest[ETH_ALEN];
  1508. + __u8 second_source[ETH_ALEN];
  1509. + __u8 second_orig_dest[ETH_ALEN];
  1510. + __be32 second_crc;
  1511. + __be16 coded_len;
  1512. +};
  1513. +
  1514. +#pragma pack()
  1515. +
  1516. +/**
  1517. + * struct batadv_unicast_tvlv_packet - generic unicast packet with tvlv payload
  1518. + * @packet_type: batman-adv packet type, part of the general header
  1519. + * @version: batman-adv protocol version, part of the genereal header
  1520. + * @ttl: time to live for this packet, part of the genereal header
  1521. + * @reserved: reserved field (for packet alignment)
  1522. + * @src: address of the source
  1523. + * @dst: address of the destination
  1524. + * @tvlv_len: length of tvlv data following the unicast tvlv header
  1525. + * @align: 2 bytes to align the header to a 4 byte boundary
  1526. + */
  1527. +struct batadv_unicast_tvlv_packet {
  1528. + __u8 packet_type;
  1529. + __u8 version; /* batman version field */
  1530. + __u8 ttl;
  1531. + __u8 reserved;
  1532. + __u8 dst[ETH_ALEN];
  1533. + __u8 src[ETH_ALEN];
  1534. + __be16 tvlv_len;
  1535. + __u16 align;
  1536. +};
  1537. +
  1538. +/**
  1539. + * struct batadv_tvlv_hdr - base tvlv header struct
  1540. + * @type: tvlv container type (see batadv_tvlv_type)
  1541. + * @version: tvlv container version
  1542. + * @len: tvlv container length
  1543. + */
  1544. +struct batadv_tvlv_hdr {
  1545. + __u8 type;
  1546. + __u8 version;
  1547. + __be16 len;
  1548. +};
  1549. +
  1550. +/**
  1551. + * struct batadv_tvlv_gateway_data - gateway data propagated through gw tvlv
  1552. + * container
  1553. + * @bandwidth_down: advertised uplink download bandwidth
  1554. + * @bandwidth_up: advertised uplink upload bandwidth
  1555. + */
  1556. +struct batadv_tvlv_gateway_data {
  1557. + __be32 bandwidth_down;
  1558. + __be32 bandwidth_up;
  1559. +};
  1560. +
  1561. +/**
  1562. + * struct batadv_tvlv_tt_data - tt data propagated through the tt tvlv container
  1563. + * @flags: translation table flags (see batadv_tt_data_flags)
  1564. + * @ttvn: translation table version number
  1565. + * @num_vlan: number of announced VLANs. In the TVLV this struct is followed by
  1566. + * one batadv_tvlv_tt_vlan_data object per announced vlan
  1567. + */
  1568. +struct batadv_tvlv_tt_data {
  1569. + __u8 flags;
  1570. + __u8 ttvn;
  1571. + __be16 num_vlan;
  1572. +};
  1573. +
  1574. +/**
  1575. + * struct batadv_tvlv_tt_vlan_data - vlan specific tt data propagated through
  1576. + * the tt tvlv container
  1577. + * @crc: crc32 checksum of the entries belonging to this vlan
  1578. + * @vid: vlan identifier
  1579. + * @reserved: unused, useful for alignment purposes
  1580. + */
  1581. +struct batadv_tvlv_tt_vlan_data {
  1582. + __be32 crc;
  1583. + __be16 vid;
  1584. + __u16 reserved;
  1585. +};
  1586. +
  1587. +/**
  1588. + * struct batadv_tvlv_tt_change - translation table diff data
  1589. + * @flags: status indicators concerning the non-mesh client (see
  1590. + * batadv_tt_client_flags)
  1591. + * @reserved: reserved field - useful for alignment purposes only
  1592. + * @addr: mac address of non-mesh client that triggered this tt change
  1593. + * @vid: VLAN identifier
  1594. + */
  1595. +struct batadv_tvlv_tt_change {
  1596. + __u8 flags;
  1597. + __u8 reserved[3];
  1598. + __u8 addr[ETH_ALEN];
  1599. + __be16 vid;
  1600. +};
  1601. +
  1602. +/**
  1603. + * struct batadv_tvlv_roam_adv - roaming advertisement
  1604. + * @client: mac address of roaming client
  1605. + * @vid: VLAN identifier
  1606. + */
  1607. +struct batadv_tvlv_roam_adv {
  1608. + __u8 client[ETH_ALEN];
  1609. + __be16 vid;
  1610. +};
  1611. +
  1612. +/**
  1613. + * struct batadv_tvlv_mcast_data - payload of a multicast tvlv
  1614. + * @flags: multicast flags announced by the orig node
  1615. + * @reserved: reserved field
  1616. + */
  1617. +struct batadv_tvlv_mcast_data {
  1618. + __u8 flags;
  1619. + __u8 reserved[3];
  1620. +};
  1621. +
  1622. +#endif /* _UAPI_LINUX_BATADV_PACKET_H_ */