1
2
3
4
5
6
7#ifndef _NET_BATMAN_ADV_BLA_H_
8#define _NET_BATMAN_ADV_BLA_H_
9
10#include "main.h"
11
12#include <linux/compiler.h>
13#include <linux/netdevice.h>
14#include <linux/netlink.h>
15#include <linux/seq_file.h>
16#include <linux/skbuff.h>
17#include <linux/stddef.h>
18#include <linux/types.h>
19
20
21
22
23
24
25
26
27
28static inline bool batadv_bla_is_loopdetect_mac(const uint8_t *mac)
29{
30 if (mac[0] == 0xba && mac[1] == 0xbe)
31 return true;
32
33 return false;
34}
35
36#ifdef CONFIG_BATMAN_ADV_BLA
37bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
38 unsigned short vid, int packet_type);
39bool batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb,
40 unsigned short vid);
41bool batadv_bla_is_backbone_gw(struct sk_buff *skb,
42 struct batadv_orig_node *orig_node,
43 int hdr_size);
44int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset);
45int batadv_bla_claim_dump(struct sk_buff *msg, struct netlink_callback *cb);
46int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq,
47 void *offset);
48int batadv_bla_backbone_dump(struct sk_buff *msg, struct netlink_callback *cb);
49bool batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, u8 *orig,
50 unsigned short vid);
51bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
52 struct sk_buff *skb);
53void batadv_bla_update_orig_address(struct batadv_priv *bat_priv,
54 struct batadv_hard_iface *primary_if,
55 struct batadv_hard_iface *oldif);
56void batadv_bla_status_update(struct net_device *net_dev);
57int batadv_bla_init(struct batadv_priv *bat_priv);
58void batadv_bla_free(struct batadv_priv *bat_priv);
59int batadv_bla_claim_dump(struct sk_buff *msg, struct netlink_callback *cb);
60#ifdef CONFIG_BATMAN_ADV_DAT
61bool batadv_bla_check_claim(struct batadv_priv *bat_priv, u8 *addr,
62 unsigned short vid);
63#endif
64#define BATADV_BLA_CRC_INIT 0
65#else
66
67static inline bool batadv_bla_rx(struct batadv_priv *bat_priv,
68 struct sk_buff *skb, unsigned short vid,
69 int packet_type)
70{
71 return false;
72}
73
74static inline bool batadv_bla_tx(struct batadv_priv *bat_priv,
75 struct sk_buff *skb, unsigned short vid)
76{
77 return false;
78}
79
80static inline bool batadv_bla_is_backbone_gw(struct sk_buff *skb,
81 struct batadv_orig_node *orig_node,
82 int hdr_size)
83{
84 return false;
85}
86
87static inline int batadv_bla_claim_table_seq_print_text(struct seq_file *seq,
88 void *offset)
89{
90 return 0;
91}
92
93static inline int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq,
94 void *offset)
95{
96 return 0;
97}
98
99static inline bool batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv,
100 u8 *orig, unsigned short vid)
101{
102 return false;
103}
104
105static inline bool
106batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
107 struct sk_buff *skb)
108{
109 return false;
110}
111
112static inline void
113batadv_bla_update_orig_address(struct batadv_priv *bat_priv,
114 struct batadv_hard_iface *primary_if,
115 struct batadv_hard_iface *oldif)
116{
117}
118
119static inline int batadv_bla_init(struct batadv_priv *bat_priv)
120{
121 return 1;
122}
123
124static inline void batadv_bla_free(struct batadv_priv *bat_priv)
125{
126}
127
128static inline int batadv_bla_claim_dump(struct sk_buff *msg,
129 struct netlink_callback *cb)
130{
131 return -EOPNOTSUPP;
132}
133
134static inline int batadv_bla_backbone_dump(struct sk_buff *msg,
135 struct netlink_callback *cb)
136{
137 return -EOPNOTSUPP;
138}
139
140static inline
141bool batadv_bla_check_claim(struct batadv_priv *bat_priv, u8 *addr,
142 unsigned short vid)
143{
144 return true;
145}
146
147#endif
148
149#endif
150