types.h 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024
  1. /* Copyright (C) 2007-2013 B.A.T.M.A.N. contributors:
  2. *
  3. * Marek Lindner, Simon Wunderlich
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of version 2 of the GNU General Public
  7. * License as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  17. * 02110-1301, USA
  18. */
  19. #ifndef _NET_BATMAN_ADV_TYPES_H_
  20. #define _NET_BATMAN_ADV_TYPES_H_
  21. #include "packet.h"
  22. #include "bitarray.h"
  23. #include <linux/kernel.h>
  24. /**
  25. * Maximum overhead for the encapsulation for a payload packet
  26. */
  27. #define BATADV_HEADER_LEN \
  28. (ETH_HLEN + max(sizeof(struct batadv_unicast_packet), \
  29. sizeof(struct batadv_bcast_packet)))
  30. #ifdef CONFIG_BATMAN_ADV_DAT
  31. /* batadv_dat_addr_t is the type used for all DHT addresses. If it is changed,
  32. * BATADV_DAT_ADDR_MAX is changed as well.
  33. *
  34. * *Please be careful: batadv_dat_addr_t must be UNSIGNED*
  35. */
  36. #define batadv_dat_addr_t uint16_t
  37. #endif /* CONFIG_BATMAN_ADV_DAT */
  38. /**
  39. * struct batadv_hard_iface_bat_iv - per hard interface B.A.T.M.A.N. IV data
  40. * @ogm_buff: buffer holding the OGM packet
  41. * @ogm_buff_len: length of the OGM packet buffer
  42. * @ogm_seqno: OGM sequence number - used to identify each OGM
  43. */
  44. struct batadv_hard_iface_bat_iv {
  45. unsigned char *ogm_buff;
  46. int ogm_buff_len;
  47. atomic_t ogm_seqno;
  48. };
  49. /**
  50. * struct batadv_hard_iface - network device known to batman-adv
  51. * @list: list node for batadv_hardif_list
  52. * @if_num: identificator of the interface
  53. * @if_status: status of the interface for batman-adv
  54. * @net_dev: pointer to the net_device
  55. * @num_bcasts: number of payload re-broadcasts on this interface (ARQ)
  56. * @hardif_obj: kobject of the per interface sysfs "mesh" directory
  57. * @refcount: number of contexts the object is used
  58. * @batman_adv_ptype: packet type describing packets that should be processed by
  59. * batman-adv for this interface
  60. * @soft_iface: the batman-adv interface which uses this network interface
  61. * @rcu: struct used for freeing in an RCU-safe manner
  62. * @bat_iv: BATMAN IV specific per hard interface data
  63. * @cleanup_work: work queue callback item for hard interface deinit
  64. */
  65. struct batadv_hard_iface {
  66. struct list_head list;
  67. int16_t if_num;
  68. char if_status;
  69. struct net_device *net_dev;
  70. uint8_t num_bcasts;
  71. struct kobject *hardif_obj;
  72. atomic_t refcount;
  73. struct packet_type batman_adv_ptype;
  74. struct net_device *soft_iface;
  75. struct rcu_head rcu;
  76. struct batadv_hard_iface_bat_iv bat_iv;
  77. struct work_struct cleanup_work;
  78. };
  79. /**
  80. * struct batadv_frag_table_entry - head in the fragment buffer table
  81. * @head: head of list with fragments
  82. * @lock: lock to protect the list of fragments
  83. * @timestamp: time (jiffie) of last received fragment
  84. * @seqno: sequence number of the fragments in the list
  85. * @size: accumulated size of packets in list
  86. */
  87. struct batadv_frag_table_entry {
  88. struct hlist_head head;
  89. spinlock_t lock; /* protects head */
  90. unsigned long timestamp;
  91. uint16_t seqno;
  92. uint16_t size;
  93. };
  94. /**
  95. * struct batadv_frag_list_entry - entry in a list of fragments
  96. * @list: list node information
  97. * @skb: fragment
  98. * @no: fragment number in the set
  99. */
  100. struct batadv_frag_list_entry {
  101. struct hlist_node list;
  102. struct sk_buff *skb;
  103. uint8_t no;
  104. };
  105. /**
  106. * struct batadv_orig_node - structure for orig_list maintaining nodes of mesh
  107. * @orig: originator ethernet address
  108. * @primary_addr: hosts primary interface address
  109. * @router: router that should be used to reach this originator
  110. * @batadv_dat_addr_t: address of the orig node in the distributed hash
  111. * @bcast_own: bitfield containing the number of our OGMs this orig_node
  112. * rebroadcasted "back" to us (relative to last_real_seqno)
  113. * @bcast_own_sum: counted result of bcast_own
  114. * @last_seen: time when last packet from this node was received
  115. * @bcast_seqno_reset: time when the broadcast seqno window was reset
  116. * @batman_seqno_reset: time when the batman seqno window was reset
  117. * @capabilities: announced capabilities of this originator
  118. * @last_ttvn: last seen translation table version number
  119. * @tt_crc: CRC of the translation table
  120. * @tt_buff: last tt changeset this node received from the orig node
  121. * @tt_buff_len: length of the last tt changeset this node received from the
  122. * orig node
  123. * @tt_buff_lock: lock that protects tt_buff and tt_buff_len
  124. * @tt_size: number of global TT entries announced by the orig node
  125. * @tt_initialised: bool keeping track of whether or not this node have received
  126. * any translation table information from the orig node yet
  127. * @last_real_seqno: last and best known sequence number
  128. * @last_ttl: ttl of last received packet
  129. * @bcast_bits: bitfield containing the info which payload broadcast originated
  130. * from this orig node this host already has seen (relative to
  131. * last_bcast_seqno)
  132. * @last_bcast_seqno: last broadcast sequence number received by this host
  133. * @neigh_list: list of potential next hop neighbor towards this orig node
  134. * @neigh_list_lock: lock protecting neigh_list, router and bonding_list
  135. * @hash_entry: hlist node for batadv_priv::orig_hash
  136. * @bat_priv: pointer to soft_iface this orig node belongs to
  137. * @ogm_cnt_lock: lock protecting bcast_own, bcast_own_sum,
  138. * neigh_node->real_bits & neigh_node->real_packet_count
  139. * @bcast_seqno_lock: lock protecting bcast_bits & last_bcast_seqno
  140. * @bond_candidates: how many candidates are available
  141. * @bond_list: list of bonding candidates
  142. * @refcount: number of contexts the object is used
  143. * @rcu: struct used for freeing in an RCU-safe manner
  144. * @in_coding_list: list of nodes this orig can hear
  145. * @out_coding_list: list of nodes that can hear this orig
  146. * @in_coding_list_lock: protects in_coding_list
  147. * @out_coding_list_lock: protects out_coding_list
  148. * @fragments: array with heads for fragment chains
  149. */
  150. struct batadv_orig_node {
  151. uint8_t orig[ETH_ALEN];
  152. uint8_t primary_addr[ETH_ALEN];
  153. struct batadv_neigh_node __rcu *router; /* rcu protected pointer */
  154. #ifdef CONFIG_BATMAN_ADV_DAT
  155. batadv_dat_addr_t dat_addr;
  156. #endif
  157. unsigned long *bcast_own;
  158. uint8_t *bcast_own_sum;
  159. unsigned long last_seen;
  160. unsigned long bcast_seqno_reset;
  161. unsigned long batman_seqno_reset;
  162. uint8_t capabilities;
  163. atomic_t last_ttvn;
  164. uint32_t tt_crc;
  165. unsigned char *tt_buff;
  166. int16_t tt_buff_len;
  167. spinlock_t tt_buff_lock; /* protects tt_buff & tt_buff_len */
  168. atomic_t tt_size;
  169. bool tt_initialised;
  170. uint32_t last_real_seqno;
  171. uint8_t last_ttl;
  172. DECLARE_BITMAP(bcast_bits, BATADV_TQ_LOCAL_WINDOW_SIZE);
  173. uint32_t last_bcast_seqno;
  174. struct hlist_head neigh_list;
  175. /* neigh_list_lock protects: neigh_list, router & bonding_list */
  176. spinlock_t neigh_list_lock;
  177. struct hlist_node hash_entry;
  178. struct batadv_priv *bat_priv;
  179. /* ogm_cnt_lock protects: bcast_own, bcast_own_sum,
  180. * neigh_node->real_bits & neigh_node->real_packet_count
  181. */
  182. spinlock_t ogm_cnt_lock;
  183. /* bcast_seqno_lock protects: bcast_bits & last_bcast_seqno */
  184. spinlock_t bcast_seqno_lock;
  185. atomic_t bond_candidates;
  186. struct list_head bond_list;
  187. atomic_t refcount;
  188. struct rcu_head rcu;
  189. #ifdef CONFIG_BATMAN_ADV_NC
  190. struct list_head in_coding_list;
  191. struct list_head out_coding_list;
  192. spinlock_t in_coding_list_lock; /* Protects in_coding_list */
  193. spinlock_t out_coding_list_lock; /* Protects out_coding_list */
  194. #endif
  195. struct batadv_frag_table_entry fragments[BATADV_FRAG_BUFFER_COUNT];
  196. };
  197. /**
  198. * enum batadv_orig_capabilities - orig node capabilities
  199. * @BATADV_ORIG_CAPA_HAS_DAT: orig node has distributed arp table enabled
  200. * @BATADV_ORIG_CAPA_HAS_NC: orig node has network coding enabled
  201. */
  202. enum batadv_orig_capabilities {
  203. BATADV_ORIG_CAPA_HAS_DAT = BIT(0),
  204. BATADV_ORIG_CAPA_HAS_NC = BIT(1),
  205. };
  206. /**
  207. * struct batadv_gw_node - structure for orig nodes announcing gw capabilities
  208. * @list: list node for batadv_priv_gw::list
  209. * @orig_node: pointer to corresponding orig node
  210. * @bandwidth_down: advertised uplink download bandwidth
  211. * @bandwidth_up: advertised uplink upload bandwidth
  212. * @deleted: this struct is scheduled for deletion
  213. * @refcount: number of contexts the object is used
  214. * @rcu: struct used for freeing in an RCU-safe manner
  215. */
  216. struct batadv_gw_node {
  217. struct hlist_node list;
  218. struct batadv_orig_node *orig_node;
  219. uint32_t bandwidth_down;
  220. uint32_t bandwidth_up;
  221. unsigned long deleted;
  222. atomic_t refcount;
  223. struct rcu_head rcu;
  224. };
  225. /**
  226. * struct batadv_neigh_node - structure for single hop neighbors
  227. * @list: list node for batadv_orig_node::neigh_list
  228. * @addr: mac address of neigh node
  229. * @tq_recv: ring buffer of received TQ values from this neigh node
  230. * @tq_index: ring buffer index
  231. * @tq_avg: averaged tq of all tq values in the ring buffer (tq_recv)
  232. * @last_ttl: last received ttl from this neigh node
  233. * @bonding_list: list node for batadv_orig_node::bond_list
  234. * @last_seen: when last packet via this neighbor was received
  235. * @real_bits: bitfield containing the number of OGMs received from this neigh
  236. * node (relative to orig_node->last_real_seqno)
  237. * @real_packet_count: counted result of real_bits
  238. * @orig_node: pointer to corresponding orig_node
  239. * @if_incoming: pointer to incoming hard interface
  240. * @lq_update_lock: lock protecting tq_recv & tq_index
  241. * @refcount: number of contexts the object is used
  242. * @rcu: struct used for freeing in an RCU-safe manner
  243. */
  244. struct batadv_neigh_node {
  245. struct hlist_node list;
  246. uint8_t addr[ETH_ALEN];
  247. uint8_t tq_recv[BATADV_TQ_GLOBAL_WINDOW_SIZE];
  248. uint8_t tq_index;
  249. uint8_t tq_avg;
  250. uint8_t last_ttl;
  251. struct list_head bonding_list;
  252. unsigned long last_seen;
  253. DECLARE_BITMAP(real_bits, BATADV_TQ_LOCAL_WINDOW_SIZE);
  254. uint8_t real_packet_count;
  255. struct batadv_orig_node *orig_node;
  256. struct batadv_hard_iface *if_incoming;
  257. spinlock_t lq_update_lock; /* protects tq_recv & tq_index */
  258. atomic_t refcount;
  259. struct rcu_head rcu;
  260. };
  261. /**
  262. * struct batadv_bcast_duplist_entry - structure for LAN broadcast suppression
  263. * @orig[ETH_ALEN]: mac address of orig node orginating the broadcast
  264. * @crc: crc32 checksum of broadcast payload
  265. * @entrytime: time when the broadcast packet was received
  266. */
  267. #ifdef CONFIG_BATMAN_ADV_BLA
  268. struct batadv_bcast_duplist_entry {
  269. uint8_t orig[ETH_ALEN];
  270. __be32 crc;
  271. unsigned long entrytime;
  272. };
  273. #endif
  274. /**
  275. * enum batadv_counters - indices for traffic counters
  276. * @BATADV_CNT_TX: transmitted payload traffic packet counter
  277. * @BATADV_CNT_TX_BYTES: transmitted payload traffic bytes counter
  278. * @BATADV_CNT_TX_DROPPED: dropped transmission payload traffic packet counter
  279. * @BATADV_CNT_RX: received payload traffic packet counter
  280. * @BATADV_CNT_RX_BYTES: received payload traffic bytes counter
  281. * @BATADV_CNT_FORWARD: forwarded payload traffic packet counter
  282. * @BATADV_CNT_FORWARD_BYTES: forwarded payload traffic bytes counter
  283. * @BATADV_CNT_MGMT_TX: transmitted routing protocol traffic packet counter
  284. * @BATADV_CNT_MGMT_TX_BYTES: transmitted routing protocol traffic bytes counter
  285. * @BATADV_CNT_MGMT_RX: received routing protocol traffic packet counter
  286. * @BATADV_CNT_MGMT_RX_BYTES: received routing protocol traffic bytes counter
  287. * @BATADV_CNT_FRAG_TX: transmitted fragment traffic packet counter
  288. * @BATADV_CNT_FRAG_TX_BYTES: transmitted fragment traffic bytes counter
  289. * @BATADV_CNT_FRAG_RX: received fragment traffic packet counter
  290. * @BATADV_CNT_FRAG_RX_BYTES: received fragment traffic bytes counter
  291. * @BATADV_CNT_FRAG_FWD: forwarded fragment traffic packet counter
  292. * @BATADV_CNT_FRAG_FWD_BYTES: forwarded fragment traffic bytes counter
  293. * @BATADV_CNT_TT_REQUEST_TX: transmitted tt req traffic packet counter
  294. * @BATADV_CNT_TT_REQUEST_RX: received tt req traffic packet counter
  295. * @BATADV_CNT_TT_RESPONSE_TX: transmitted tt resp traffic packet counter
  296. * @BATADV_CNT_TT_RESPONSE_RX: received tt resp traffic packet counter
  297. * @BATADV_CNT_TT_ROAM_ADV_TX: transmitted tt roam traffic packet counter
  298. * @BATADV_CNT_TT_ROAM_ADV_RX: received tt roam traffic packet counter
  299. * @BATADV_CNT_DAT_GET_TX: transmitted dht GET traffic packet counter
  300. * @BATADV_CNT_DAT_GET_RX: received dht GET traffic packet counter
  301. * @BATADV_CNT_DAT_PUT_TX: transmitted dht PUT traffic packet counter
  302. * @BATADV_CNT_DAT_PUT_RX: received dht PUT traffic packet counter
  303. * @BATADV_CNT_DAT_CACHED_REPLY_TX: transmitted dat cache reply traffic packet
  304. * counter
  305. * @BATADV_CNT_NC_CODE: transmitted nc-combined traffic packet counter
  306. * @BATADV_CNT_NC_CODE_BYTES: transmitted nc-combined traffic bytes counter
  307. * @BATADV_CNT_NC_RECODE: transmitted nc-recombined traffic packet counter
  308. * @BATADV_CNT_NC_RECODE_BYTES: transmitted nc-recombined traffic bytes counter
  309. * @BATADV_CNT_NC_BUFFER: counter for packets buffered for later nc decoding
  310. * @BATADV_CNT_NC_DECODE: received and nc-decoded traffic packet counter
  311. * @BATADV_CNT_NC_DECODE_BYTES: received and nc-decoded traffic bytes counter
  312. * @BATADV_CNT_NC_DECODE_FAILED: received and decode-failed traffic packet
  313. * counter
  314. * @BATADV_CNT_NC_SNIFFED: counter for nc-decoded packets received in promisc
  315. * mode.
  316. * @BATADV_CNT_NUM: number of traffic counters
  317. */
  318. enum batadv_counters {
  319. BATADV_CNT_TX,
  320. BATADV_CNT_TX_BYTES,
  321. BATADV_CNT_TX_DROPPED,
  322. BATADV_CNT_RX,
  323. BATADV_CNT_RX_BYTES,
  324. BATADV_CNT_FORWARD,
  325. BATADV_CNT_FORWARD_BYTES,
  326. BATADV_CNT_MGMT_TX,
  327. BATADV_CNT_MGMT_TX_BYTES,
  328. BATADV_CNT_MGMT_RX,
  329. BATADV_CNT_MGMT_RX_BYTES,
  330. BATADV_CNT_FRAG_TX,
  331. BATADV_CNT_FRAG_TX_BYTES,
  332. BATADV_CNT_FRAG_RX,
  333. BATADV_CNT_FRAG_RX_BYTES,
  334. BATADV_CNT_FRAG_FWD,
  335. BATADV_CNT_FRAG_FWD_BYTES,
  336. BATADV_CNT_TT_REQUEST_TX,
  337. BATADV_CNT_TT_REQUEST_RX,
  338. BATADV_CNT_TT_RESPONSE_TX,
  339. BATADV_CNT_TT_RESPONSE_RX,
  340. BATADV_CNT_TT_ROAM_ADV_TX,
  341. BATADV_CNT_TT_ROAM_ADV_RX,
  342. #ifdef CONFIG_BATMAN_ADV_DAT
  343. BATADV_CNT_DAT_GET_TX,
  344. BATADV_CNT_DAT_GET_RX,
  345. BATADV_CNT_DAT_PUT_TX,
  346. BATADV_CNT_DAT_PUT_RX,
  347. BATADV_CNT_DAT_CACHED_REPLY_TX,
  348. #endif
  349. #ifdef CONFIG_BATMAN_ADV_NC
  350. BATADV_CNT_NC_CODE,
  351. BATADV_CNT_NC_CODE_BYTES,
  352. BATADV_CNT_NC_RECODE,
  353. BATADV_CNT_NC_RECODE_BYTES,
  354. BATADV_CNT_NC_BUFFER,
  355. BATADV_CNT_NC_DECODE,
  356. BATADV_CNT_NC_DECODE_BYTES,
  357. BATADV_CNT_NC_DECODE_FAILED,
  358. BATADV_CNT_NC_SNIFFED,
  359. #endif
  360. BATADV_CNT_NUM,
  361. };
  362. /**
  363. * struct batadv_priv_tt - per mesh interface translation table data
  364. * @vn: translation table version number
  365. * @ogm_append_cnt: counter of number of OGMs containing the local tt diff
  366. * @local_changes: changes registered in an originator interval
  367. * @changes_list: tracks tt local changes within an originator interval
  368. * @local_hash: local translation table hash table
  369. * @global_hash: global translation table hash table
  370. * @req_list: list of pending & unanswered tt_requests
  371. * @roam_list: list of the last roaming events of each client limiting the
  372. * number of roaming events to avoid route flapping
  373. * @changes_list_lock: lock protecting changes_list
  374. * @req_list_lock: lock protecting req_list
  375. * @roam_list_lock: lock protecting roam_list
  376. * @local_entry_num: number of entries in the local hash table
  377. * @local_crc: Checksum of the local table, recomputed before sending a new OGM
  378. * @last_changeset: last tt changeset this host has generated
  379. * @last_changeset_len: length of last tt changeset this host has generated
  380. * @last_changeset_lock: lock protecting last_changeset & last_changeset_len
  381. * @work: work queue callback item for translation table purging
  382. */
  383. struct batadv_priv_tt {
  384. atomic_t vn;
  385. atomic_t ogm_append_cnt;
  386. atomic_t local_changes;
  387. struct list_head changes_list;
  388. struct batadv_hashtable *local_hash;
  389. struct batadv_hashtable *global_hash;
  390. struct list_head req_list;
  391. struct list_head roam_list;
  392. spinlock_t changes_list_lock; /* protects changes */
  393. spinlock_t req_list_lock; /* protects req_list */
  394. spinlock_t roam_list_lock; /* protects roam_list */
  395. atomic_t local_entry_num;
  396. uint32_t local_crc;
  397. unsigned char *last_changeset;
  398. int16_t last_changeset_len;
  399. /* protects last_changeset & last_changeset_len */
  400. spinlock_t last_changeset_lock;
  401. struct delayed_work work;
  402. };
  403. /**
  404. * struct batadv_priv_bla - per mesh interface bridge loope avoidance data
  405. * @num_requests; number of bla requests in flight
  406. * @claim_hash: hash table containing mesh nodes this host has claimed
  407. * @backbone_hash: hash table containing all detected backbone gateways
  408. * @bcast_duplist: recently received broadcast packets array (for broadcast
  409. * duplicate suppression)
  410. * @bcast_duplist_curr: index of last broadcast packet added to bcast_duplist
  411. * @bcast_duplist_lock: lock protecting bcast_duplist & bcast_duplist_curr
  412. * @claim_dest: local claim data (e.g. claim group)
  413. * @work: work queue callback item for cleanups & bla announcements
  414. */
  415. #ifdef CONFIG_BATMAN_ADV_BLA
  416. struct batadv_priv_bla {
  417. atomic_t num_requests;
  418. struct batadv_hashtable *claim_hash;
  419. struct batadv_hashtable *backbone_hash;
  420. struct batadv_bcast_duplist_entry bcast_duplist[BATADV_DUPLIST_SIZE];
  421. int bcast_duplist_curr;
  422. /* protects bcast_duplist & bcast_duplist_curr */
  423. spinlock_t bcast_duplist_lock;
  424. struct batadv_bla_claim_dst claim_dest;
  425. struct delayed_work work;
  426. };
  427. #endif
  428. /**
  429. * struct batadv_debug_log - debug logging data
  430. * @log_buff: buffer holding the logs (ring bufer)
  431. * @log_start: index of next character to read
  432. * @log_end: index of next character to write
  433. * @lock: lock protecting log_buff, log_start & log_end
  434. * @queue_wait: log reader's wait queue
  435. */
  436. #ifdef CONFIG_BATMAN_ADV_DEBUG
  437. struct batadv_priv_debug_log {
  438. char log_buff[BATADV_LOG_BUF_LEN];
  439. unsigned long log_start;
  440. unsigned long log_end;
  441. spinlock_t lock; /* protects log_buff, log_start and log_end */
  442. wait_queue_head_t queue_wait;
  443. };
  444. #endif
  445. /**
  446. * struct batadv_priv_gw - per mesh interface gateway data
  447. * @list: list of available gateway nodes
  448. * @list_lock: lock protecting gw_list & curr_gw
  449. * @curr_gw: pointer to currently selected gateway node
  450. * @bandwidth_down: advertised uplink download bandwidth (if gw_mode server)
  451. * @bandwidth_up: advertised uplink upload bandwidth (if gw_mode server)
  452. * @reselect: bool indicating a gateway re-selection is in progress
  453. */
  454. struct batadv_priv_gw {
  455. struct hlist_head list;
  456. spinlock_t list_lock; /* protects gw_list & curr_gw */
  457. struct batadv_gw_node __rcu *curr_gw; /* rcu protected pointer */
  458. atomic_t bandwidth_down;
  459. atomic_t bandwidth_up;
  460. atomic_t reselect;
  461. };
  462. /**
  463. * struct batadv_priv_tvlv - per mesh interface tvlv data
  464. * @container_list: list of registered tvlv containers to be sent with each OGM
  465. * @handler_list: list of the various tvlv content handlers
  466. * @container_list_lock: protects tvlv container list access
  467. * @handler_list_lock: protects handler list access
  468. */
  469. struct batadv_priv_tvlv {
  470. struct hlist_head container_list;
  471. struct hlist_head handler_list;
  472. spinlock_t container_list_lock; /* protects container_list */
  473. spinlock_t handler_list_lock; /* protects handler_list */
  474. };
  475. /**
  476. * struct batadv_priv_dat - per mesh interface DAT private data
  477. * @addr: node DAT address
  478. * @hash: hashtable representing the local ARP cache
  479. * @work: work queue callback item for cache purging
  480. */
  481. #ifdef CONFIG_BATMAN_ADV_DAT
  482. struct batadv_priv_dat {
  483. batadv_dat_addr_t addr;
  484. struct batadv_hashtable *hash;
  485. struct delayed_work work;
  486. };
  487. #endif
  488. /**
  489. * struct batadv_priv_nc - per mesh interface network coding private data
  490. * @work: work queue callback item for cleanup
  491. * @debug_dir: dentry for nc subdir in batman-adv directory in debugfs
  492. * @min_tq: only consider neighbors for encoding if neigh_tq > min_tq
  493. * @max_fwd_delay: maximum packet forward delay to allow coding of packets
  494. * @max_buffer_time: buffer time for sniffed packets used to decoding
  495. * @timestamp_fwd_flush: timestamp of last forward packet queue flush
  496. * @timestamp_sniffed_purge: timestamp of last sniffed packet queue purge
  497. * @coding_hash: Hash table used to buffer skbs while waiting for another
  498. * incoming skb to code it with. Skbs are added to the buffer just before being
  499. * forwarded in routing.c
  500. * @decoding_hash: Hash table used to buffer skbs that might be needed to decode
  501. * a received coded skb. The buffer is used for 1) skbs arriving on the
  502. * soft-interface; 2) skbs overheard on the hard-interface; and 3) skbs
  503. * forwarded by batman-adv.
  504. */
  505. struct batadv_priv_nc {
  506. struct delayed_work work;
  507. struct dentry *debug_dir;
  508. u8 min_tq;
  509. u32 max_fwd_delay;
  510. u32 max_buffer_time;
  511. unsigned long timestamp_fwd_flush;
  512. unsigned long timestamp_sniffed_purge;
  513. struct batadv_hashtable *coding_hash;
  514. struct batadv_hashtable *decoding_hash;
  515. };
  516. /**
  517. * struct batadv_priv - per mesh interface data
  518. * @mesh_state: current status of the mesh (inactive/active/deactivating)
  519. * @soft_iface: net device which holds this struct as private data
  520. * @stats: structure holding the data for the ndo_get_stats() call
  521. * @bat_counters: mesh internal traffic statistic counters (see batadv_counters)
  522. * @aggregated_ogms: bool indicating whether OGM aggregation is enabled
  523. * @bonding: bool indicating whether traffic bonding is enabled
  524. * @fragmentation: bool indicating whether traffic fragmentation is enabled
  525. * @frag_seqno: incremental counter to identify chains of egress fragments
  526. * @ap_isolation: bool indicating whether ap isolation is enabled
  527. * @bridge_loop_avoidance: bool indicating whether bridge loop avoidance is
  528. * enabled
  529. * @distributed_arp_table: bool indicating whether distributed ARP table is
  530. * enabled
  531. * @gw_mode: gateway operation: off, client or server (see batadv_gw_modes)
  532. * @gw_sel_class: gateway selection class (applies if gw_mode client)
  533. * @orig_interval: OGM broadcast interval in milliseconds
  534. * @hop_penalty: penalty which will be applied to an OGM's tq-field on every hop
  535. * @log_level: configured log level (see batadv_dbg_level)
  536. * @bcast_seqno: last sent broadcast packet sequence number
  537. * @bcast_queue_left: number of remaining buffered broadcast packet slots
  538. * @batman_queue_left: number of remaining OGM packet slots
  539. * @num_ifaces: number of interfaces assigned to this mesh interface
  540. * @mesh_obj: kobject for sysfs mesh subdirectory
  541. * @debug_dir: dentry for debugfs batman-adv subdirectory
  542. * @forw_bat_list: list of aggregated OGMs that will be forwarded
  543. * @forw_bcast_list: list of broadcast packets that will be rebroadcasted
  544. * @orig_hash: hash table containing mesh participants (orig nodes)
  545. * @forw_bat_list_lock: lock protecting forw_bat_list
  546. * @forw_bcast_list_lock: lock protecting forw_bcast_list
  547. * @orig_work: work queue callback item for orig node purging
  548. * @cleanup_work: work queue callback item for soft interface deinit
  549. * @primary_if: one of the hard interfaces assigned to this mesh interface
  550. * becomes the primary interface
  551. * @bat_algo_ops: routing algorithm used by this mesh interface
  552. * @bla: bridge loope avoidance data
  553. * @debug_log: holding debug logging relevant data
  554. * @gw: gateway data
  555. * @tt: translation table data
  556. * @tvlv: type-version-length-value data
  557. * @dat: distributed arp table data
  558. * @network_coding: bool indicating whether network coding is enabled
  559. * @batadv_priv_nc: network coding data
  560. */
  561. struct batadv_priv {
  562. atomic_t mesh_state;
  563. struct net_device *soft_iface;
  564. struct net_device_stats stats;
  565. uint64_t __percpu *bat_counters; /* Per cpu counters */
  566. atomic_t aggregated_ogms;
  567. atomic_t bonding;
  568. atomic_t fragmentation;
  569. atomic_t frag_seqno;
  570. atomic_t ap_isolation;
  571. #ifdef CONFIG_BATMAN_ADV_BLA
  572. atomic_t bridge_loop_avoidance;
  573. #endif
  574. #ifdef CONFIG_BATMAN_ADV_DAT
  575. atomic_t distributed_arp_table;
  576. #endif
  577. atomic_t gw_mode;
  578. atomic_t gw_sel_class;
  579. atomic_t orig_interval;
  580. atomic_t hop_penalty;
  581. #ifdef CONFIG_BATMAN_ADV_DEBUG
  582. atomic_t log_level;
  583. #endif
  584. atomic_t bcast_seqno;
  585. atomic_t bcast_queue_left;
  586. atomic_t batman_queue_left;
  587. char num_ifaces;
  588. struct kobject *mesh_obj;
  589. struct dentry *debug_dir;
  590. struct hlist_head forw_bat_list;
  591. struct hlist_head forw_bcast_list;
  592. struct batadv_hashtable *orig_hash;
  593. spinlock_t forw_bat_list_lock; /* protects forw_bat_list */
  594. spinlock_t forw_bcast_list_lock; /* protects forw_bcast_list */
  595. struct delayed_work orig_work;
  596. struct work_struct cleanup_work;
  597. struct batadv_hard_iface __rcu *primary_if; /* rcu protected pointer */
  598. struct batadv_algo_ops *bat_algo_ops;
  599. #ifdef CONFIG_BATMAN_ADV_BLA
  600. struct batadv_priv_bla bla;
  601. #endif
  602. #ifdef CONFIG_BATMAN_ADV_DEBUG
  603. struct batadv_priv_debug_log *debug_log;
  604. #endif
  605. struct batadv_priv_gw gw;
  606. struct batadv_priv_tt tt;
  607. struct batadv_priv_tvlv tvlv;
  608. #ifdef CONFIG_BATMAN_ADV_DAT
  609. struct batadv_priv_dat dat;
  610. #endif
  611. #ifdef CONFIG_BATMAN_ADV_NC
  612. atomic_t network_coding;
  613. struct batadv_priv_nc nc;
  614. #endif /* CONFIG_BATMAN_ADV_NC */
  615. };
  616. /**
  617. * struct batadv_socket_client - layer2 icmp socket client data
  618. * @queue_list: packet queue for packets destined for this socket client
  619. * @queue_len: number of packets in the packet queue (queue_list)
  620. * @index: socket client's index in the batadv_socket_client_hash
  621. * @lock: lock protecting queue_list, queue_len & index
  622. * @queue_wait: socket client's wait queue
  623. * @bat_priv: pointer to soft_iface this client belongs to
  624. */
  625. struct batadv_socket_client {
  626. struct list_head queue_list;
  627. unsigned int queue_len;
  628. unsigned char index;
  629. spinlock_t lock; /* protects queue_list, queue_len & index */
  630. wait_queue_head_t queue_wait;
  631. struct batadv_priv *bat_priv;
  632. };
  633. /**
  634. * struct batadv_socket_packet - layer2 icmp packet for socket client
  635. * @list: list node for batadv_socket_client::queue_list
  636. * @icmp_len: size of the layer2 icmp packet
  637. * @icmp_packet: layer2 icmp packet
  638. */
  639. struct batadv_socket_packet {
  640. struct list_head list;
  641. size_t icmp_len;
  642. struct batadv_icmp_packet_rr icmp_packet;
  643. };
  644. /**
  645. * struct batadv_bla_backbone_gw - batman-adv gateway bridged into the LAN
  646. * @orig: originator address of backbone node (mac address of primary iface)
  647. * @vid: vlan id this gateway was detected on
  648. * @hash_entry: hlist node for batadv_priv_bla::backbone_hash
  649. * @bat_priv: pointer to soft_iface this backbone gateway belongs to
  650. * @lasttime: last time we heard of this backbone gw
  651. * @wait_periods: grace time for bridge forward delays and bla group forming at
  652. * bootup phase - no bcast traffic is formwared until it has elapsed
  653. * @request_sent: if this bool is set to true we are out of sync with this
  654. * backbone gateway - no bcast traffic is formwared until the situation was
  655. * resolved
  656. * @crc: crc16 checksum over all claims
  657. * @refcount: number of contexts the object is used
  658. * @rcu: struct used for freeing in an RCU-safe manner
  659. */
  660. #ifdef CONFIG_BATMAN_ADV_BLA
  661. struct batadv_bla_backbone_gw {
  662. uint8_t orig[ETH_ALEN];
  663. unsigned short vid;
  664. struct hlist_node hash_entry;
  665. struct batadv_priv *bat_priv;
  666. unsigned long lasttime;
  667. atomic_t wait_periods;
  668. atomic_t request_sent;
  669. uint16_t crc;
  670. atomic_t refcount;
  671. struct rcu_head rcu;
  672. };
  673. /**
  674. * struct batadv_bla_claim - claimed non-mesh client structure
  675. * @addr: mac address of claimed non-mesh client
  676. * @vid: vlan id this client was detected on
  677. * @batadv_bla_backbone_gw: pointer to backbone gw claiming this client
  678. * @lasttime: last time we heard of claim (locals only)
  679. * @hash_entry: hlist node for batadv_priv_bla::claim_hash
  680. * @refcount: number of contexts the object is used
  681. * @rcu: struct used for freeing in an RCU-safe manner
  682. */
  683. struct batadv_bla_claim {
  684. uint8_t addr[ETH_ALEN];
  685. unsigned short vid;
  686. struct batadv_bla_backbone_gw *backbone_gw;
  687. unsigned long lasttime;
  688. struct hlist_node hash_entry;
  689. struct rcu_head rcu;
  690. atomic_t refcount;
  691. };
  692. #endif
  693. /**
  694. * struct batadv_tt_common_entry - tt local & tt global common data
  695. * @addr: mac address of non-mesh client
  696. * @hash_entry: hlist node for batadv_priv_tt::local_hash or for
  697. * batadv_priv_tt::global_hash
  698. * @flags: various state handling flags (see batadv_tt_client_flags)
  699. * @added_at: timestamp used for purging stale tt common entries
  700. * @refcount: number of contexts the object is used
  701. * @rcu: struct used for freeing in an RCU-safe manner
  702. */
  703. struct batadv_tt_common_entry {
  704. uint8_t addr[ETH_ALEN];
  705. struct hlist_node hash_entry;
  706. uint16_t flags;
  707. unsigned long added_at;
  708. atomic_t refcount;
  709. struct rcu_head rcu;
  710. };
  711. /**
  712. * struct batadv_tt_local_entry - translation table local entry data
  713. * @common: general translation table data
  714. * @last_seen: timestamp used for purging stale tt local entries
  715. */
  716. struct batadv_tt_local_entry {
  717. struct batadv_tt_common_entry common;
  718. unsigned long last_seen;
  719. };
  720. /**
  721. * struct batadv_tt_global_entry - translation table global entry data
  722. * @common: general translation table data
  723. * @orig_list: list of orig nodes announcing this non-mesh client
  724. * @list_lock: lock protecting orig_list
  725. * @roam_at: time at which TT_GLOBAL_ROAM was set
  726. */
  727. struct batadv_tt_global_entry {
  728. struct batadv_tt_common_entry common;
  729. struct hlist_head orig_list;
  730. spinlock_t list_lock; /* protects orig_list */
  731. unsigned long roam_at;
  732. };
  733. /**
  734. * struct batadv_tt_orig_list_entry - orig node announcing a non-mesh client
  735. * @orig_node: pointer to orig node announcing this non-mesh client
  736. * @ttvn: translation table version number which added the non-mesh client
  737. * @list: list node for batadv_tt_global_entry::orig_list
  738. * @refcount: number of contexts the object is used
  739. * @rcu: struct used for freeing in an RCU-safe manner
  740. */
  741. struct batadv_tt_orig_list_entry {
  742. struct batadv_orig_node *orig_node;
  743. uint8_t ttvn;
  744. struct hlist_node list;
  745. atomic_t refcount;
  746. struct rcu_head rcu;
  747. };
  748. /**
  749. * struct batadv_tt_change_node - structure for tt changes occured
  750. * @list: list node for batadv_priv_tt::changes_list
  751. * @change: holds the actual translation table diff data
  752. */
  753. struct batadv_tt_change_node {
  754. struct list_head list;
  755. struct batadv_tvlv_tt_change change;
  756. };
  757. /**
  758. * struct batadv_tt_req_node - data to keep track of the tt requests in flight
  759. * @addr: mac address address of the originator this request was sent to
  760. * @issued_at: timestamp used for purging stale tt requests
  761. * @list: list node for batadv_priv_tt::req_list
  762. */
  763. struct batadv_tt_req_node {
  764. uint8_t addr[ETH_ALEN];
  765. unsigned long issued_at;
  766. struct list_head list;
  767. };
  768. /**
  769. * struct batadv_tt_roam_node - roaming client data
  770. * @addr: mac address of the client in the roaming phase
  771. * @counter: number of allowed roaming events per client within a single
  772. * OGM interval (changes are committed with each OGM)
  773. * @first_time: timestamp used for purging stale roaming node entries
  774. * @list: list node for batadv_priv_tt::roam_list
  775. */
  776. struct batadv_tt_roam_node {
  777. uint8_t addr[ETH_ALEN];
  778. atomic_t counter;
  779. unsigned long first_time;
  780. struct list_head list;
  781. };
  782. /**
  783. * struct batadv_nc_node - network coding node
  784. * @list: next and prev pointer for the list handling
  785. * @addr: the node's mac address
  786. * @refcount: number of contexts the object is used by
  787. * @rcu: struct used for freeing in an RCU-safe manner
  788. * @orig_node: pointer to corresponding orig node struct
  789. * @last_seen: timestamp of last ogm received from this node
  790. */
  791. struct batadv_nc_node {
  792. struct list_head list;
  793. uint8_t addr[ETH_ALEN];
  794. atomic_t refcount;
  795. struct rcu_head rcu;
  796. struct batadv_orig_node *orig_node;
  797. unsigned long last_seen;
  798. };
  799. /**
  800. * struct batadv_nc_path - network coding path
  801. * @hash_entry: next and prev pointer for the list handling
  802. * @rcu: struct used for freeing in an RCU-safe manner
  803. * @refcount: number of contexts the object is used by
  804. * @packet_list: list of buffered packets for this path
  805. * @packet_list_lock: access lock for packet list
  806. * @next_hop: next hop (destination) of path
  807. * @prev_hop: previous hop (source) of path
  808. * @last_valid: timestamp for last validation of path
  809. */
  810. struct batadv_nc_path {
  811. struct hlist_node hash_entry;
  812. struct rcu_head rcu;
  813. atomic_t refcount;
  814. struct list_head packet_list;
  815. spinlock_t packet_list_lock; /* Protects packet_list */
  816. uint8_t next_hop[ETH_ALEN];
  817. uint8_t prev_hop[ETH_ALEN];
  818. unsigned long last_valid;
  819. };
  820. /**
  821. * struct batadv_nc_packet - network coding packet used when coding and
  822. * decoding packets
  823. * @list: next and prev pointer for the list handling
  824. * @packet_id: crc32 checksum of skb data
  825. * @timestamp: field containing the info when the packet was added to path
  826. * @neigh_node: pointer to original next hop neighbor of skb
  827. * @skb: skb which can be encoded or used for decoding
  828. * @nc_path: pointer to path this nc packet is attached to
  829. */
  830. struct batadv_nc_packet {
  831. struct list_head list;
  832. __be32 packet_id;
  833. unsigned long timestamp;
  834. struct batadv_neigh_node *neigh_node;
  835. struct sk_buff *skb;
  836. struct batadv_nc_path *nc_path;
  837. };
  838. /**
  839. * batadv_skb_cb - control buffer structure used to store private data relevant
  840. * to batman-adv in the skb->cb buffer in skbs.
  841. * @decoded: Marks a skb as decoded, which is checked when searching for coding
  842. * opportunities in network-coding.c
  843. */
  844. struct batadv_skb_cb {
  845. bool decoded;
  846. };
  847. /**
  848. * struct batadv_forw_packet - structure for bcast packets to be sent/forwarded
  849. * @list: list node for batadv_socket_client::queue_list
  850. * @send_time: execution time for delayed_work (packet sending)
  851. * @own: bool for locally generated packets (local OGMs are re-scheduled after
  852. * sending)
  853. * @skb: bcast packet's skb buffer
  854. * @packet_len: size of aggregated OGM packet inside the skb buffer
  855. * @direct_link_flags: direct link flags for aggregated OGM packets
  856. * @num_packets: counter for bcast packet retransmission
  857. * @delayed_work: work queue callback item for packet sending
  858. * @if_incoming: pointer incoming hard-iface or primary iface if locally
  859. * generated packet
  860. */
  861. struct batadv_forw_packet {
  862. struct hlist_node list;
  863. unsigned long send_time;
  864. uint8_t own;
  865. struct sk_buff *skb;
  866. uint16_t packet_len;
  867. uint32_t direct_link_flags;
  868. uint8_t num_packets;
  869. struct delayed_work delayed_work;
  870. struct batadv_hard_iface *if_incoming;
  871. };
  872. /**
  873. * struct batadv_algo_ops - mesh algorithm callbacks
  874. * @list: list node for the batadv_algo_list
  875. * @name: name of the algorithm
  876. * @bat_iface_enable: init routing info when hard-interface is enabled
  877. * @bat_iface_disable: de-init routing info when hard-interface is disabled
  878. * @bat_iface_update_mac: (re-)init mac addresses of the protocol information
  879. * belonging to this hard-interface
  880. * @bat_primary_iface_set: called when primary interface is selected / changed
  881. * @bat_ogm_schedule: prepare a new outgoing OGM for the send queue
  882. * @bat_ogm_emit: send scheduled OGM
  883. */
  884. struct batadv_algo_ops {
  885. struct hlist_node list;
  886. char *name;
  887. int (*bat_iface_enable)(struct batadv_hard_iface *hard_iface);
  888. void (*bat_iface_disable)(struct batadv_hard_iface *hard_iface);
  889. void (*bat_iface_update_mac)(struct batadv_hard_iface *hard_iface);
  890. void (*bat_primary_iface_set)(struct batadv_hard_iface *hard_iface);
  891. void (*bat_ogm_schedule)(struct batadv_hard_iface *hard_iface);
  892. void (*bat_ogm_emit)(struct batadv_forw_packet *forw_packet);
  893. };
  894. /**
  895. * struct batadv_dat_entry - it is a single entry of batman-adv ARP backend. It
  896. * is used to stored ARP entries needed for the global DAT cache
  897. * @ip: the IPv4 corresponding to this DAT/ARP entry
  898. * @mac_addr: the MAC address associated to the stored IPv4
  899. * @last_update: time in jiffies when this entry was refreshed last time
  900. * @hash_entry: hlist node for batadv_priv_dat::hash
  901. * @refcount: number of contexts the object is used
  902. * @rcu: struct used for freeing in an RCU-safe manner
  903. */
  904. struct batadv_dat_entry {
  905. __be32 ip;
  906. uint8_t mac_addr[ETH_ALEN];
  907. unsigned long last_update;
  908. struct hlist_node hash_entry;
  909. atomic_t refcount;
  910. struct rcu_head rcu;
  911. };
  912. /**
  913. * struct batadv_dat_candidate - candidate destination for DAT operations
  914. * @type: the type of the selected candidate. It can one of the following:
  915. * - BATADV_DAT_CANDIDATE_NOT_FOUND
  916. * - BATADV_DAT_CANDIDATE_ORIG
  917. * @orig_node: if type is BATADV_DAT_CANDIDATE_ORIG this field points to the
  918. * corresponding originator node structure
  919. */
  920. struct batadv_dat_candidate {
  921. int type;
  922. struct batadv_orig_node *orig_node;
  923. };
  924. /**
  925. * struct batadv_tvlv_container - container for tvlv appended to OGMs
  926. * @list: hlist node for batadv_priv_tvlv::container_list
  927. * @tvlv_hdr: tvlv header information needed to construct the tvlv
  928. * @value_len: length of the buffer following this struct which contains
  929. * the actual tvlv payload
  930. * @refcount: number of contexts the object is used
  931. */
  932. struct batadv_tvlv_container {
  933. struct hlist_node list;
  934. struct batadv_tvlv_hdr tvlv_hdr;
  935. atomic_t refcount;
  936. };
  937. /**
  938. * struct batadv_tvlv_handler - handler for specific tvlv type and version
  939. * @list: hlist node for batadv_priv_tvlv::handler_list
  940. * @ogm_handler: handler callback which is given the tvlv payload to process on
  941. * incoming OGM packets
  942. * @unicast_handler: handler callback which is given the tvlv payload to process
  943. * on incoming unicast tvlv packets
  944. * @type: tvlv type this handler feels responsible for
  945. * @version: tvlv version this handler feels responsible for
  946. * @flags: tvlv handler flags
  947. * @refcount: number of contexts the object is used
  948. * @rcu: struct used for freeing in an RCU-safe manner
  949. */
  950. struct batadv_tvlv_handler {
  951. struct hlist_node list;
  952. void (*ogm_handler)(struct batadv_priv *bat_priv,
  953. struct batadv_orig_node *orig,
  954. uint8_t flags,
  955. void *tvlv_value, uint16_t tvlv_value_len);
  956. int (*unicast_handler)(struct batadv_priv *bat_priv,
  957. uint8_t *src, uint8_t *dst,
  958. void *tvlv_value, uint16_t tvlv_value_len);
  959. uint8_t type;
  960. uint8_t version;
  961. uint8_t flags;
  962. atomic_t refcount;
  963. struct rcu_head rcu;
  964. };
  965. /**
  966. * enum batadv_tvlv_handler_flags - tvlv handler flags definitions
  967. * @BATADV_TVLV_HANDLER_OGM_CIFNOTFND: tvlv ogm processing function will call
  968. * this handler even if its type was not found (with no data)
  969. * @BATADV_TVLV_HANDLER_OGM_CALLED: interval tvlv handling flag - the API marks
  970. * a handler as being called, so it won't be called if the
  971. * BATADV_TVLV_HANDLER_OGM_CIFNOTFND flag was set
  972. */
  973. enum batadv_tvlv_handler_flags {
  974. BATADV_TVLV_HANDLER_OGM_CIFNOTFND = BIT(1),
  975. BATADV_TVLV_HANDLER_OGM_CALLED = BIT(2),
  976. };
  977. #endif /* _NET_BATMAN_ADV_TYPES_H_ */