]>
Commit | Line | Data |
---|---|---|
7db7d9f3 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
7a79d717 | 2 | /* Copyright (C) 2011-2019 B.A.T.M.A.N. contributors: |
23721387 SW |
3 | * |
4 | * Simon Wunderlich | |
23721387 SW |
5 | */ |
6 | ||
7 | #ifndef _NET_BATMAN_ADV_BLA_H_ | |
8 | #define _NET_BATMAN_ADV_BLA_H_ | |
9 | ||
1e2c2a4f SE |
10 | #include "main.h" |
11 | ||
d3e9768a SW |
12 | #include <linux/compiler.h> |
13 | #include <linux/stddef.h> | |
1e2c2a4f SE |
14 | #include <linux/types.h> |
15 | ||
d68081a2 | 16 | struct net_device; |
04f3f5bf | 17 | struct netlink_callback; |
1e2c2a4f SE |
18 | struct seq_file; |
19 | struct sk_buff; | |
20 | ||
d3e9768a | 21 | /** |
7e9a8c2c SE |
22 | * batadv_bla_is_loopdetect_mac() - check if the mac address is from a loop |
23 | * detect frame sent by bridge loop avoidance | |
d3e9768a SW |
24 | * @mac: mac address to check |
25 | * | |
26 | * Return: true if the it looks like a loop detect frame | |
27 | * (mac starts with BA:BE), false otherwise | |
28 | */ | |
29 | static inline bool batadv_bla_is_loopdetect_mac(const uint8_t *mac) | |
30 | { | |
31 | if (mac[0] == 0xba && mac[1] == 0xbe) | |
32 | return true; | |
33 | ||
34 | return false; | |
35 | } | |
36 | ||
7a5cc242 | 37 | #ifdef CONFIG_BATMAN_ADV_BLA |
4b426b10 SE |
38 | bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, |
39 | unsigned short vid, bool is_bcast); | |
40 | bool batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, | |
41 | unsigned short vid); | |
42 | bool batadv_bla_is_backbone_gw(struct sk_buff *skb, | |
43 | struct batadv_orig_node *orig_node, | |
44 | int hdr_size); | |
08adf151 | 45 | int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset); |
04f3f5bf | 46 | int batadv_bla_claim_dump(struct sk_buff *msg, struct netlink_callback *cb); |
536a23f1 SW |
47 | int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, |
48 | void *offset); | |
ea4152e1 | 49 | int batadv_bla_backbone_dump(struct sk_buff *msg, struct netlink_callback *cb); |
6b5e971a | 50 | bool batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, u8 *orig, |
cfd4f757 | 51 | unsigned short vid); |
4b426b10 SE |
52 | bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, |
53 | struct sk_buff *skb); | |
56303d34 SE |
54 | void batadv_bla_update_orig_address(struct batadv_priv *bat_priv, |
55 | struct batadv_hard_iface *primary_if, | |
56 | struct batadv_hard_iface *oldif); | |
d68081a2 | 57 | void batadv_bla_status_update(struct net_device *net_dev); |
56303d34 SE |
58 | int batadv_bla_init(struct batadv_priv *bat_priv); |
59 | void batadv_bla_free(struct batadv_priv *bat_priv); | |
04f3f5bf | 60 | int batadv_bla_claim_dump(struct sk_buff *msg, struct netlink_callback *cb); |
00311de5 AP |
61 | #ifdef CONFIG_BATMAN_ADV_DAT |
62 | bool batadv_bla_check_claim(struct batadv_priv *bat_priv, u8 *addr, | |
63 | unsigned short vid); | |
64 | #endif | |
3964f728 | 65 | #define BATADV_BLA_CRC_INIT 0 |
7a5cc242 SW |
66 | #else /* ifdef CONFIG_BATMAN_ADV_BLA */ |
67 | ||
4b426b10 SE |
68 | static inline bool batadv_bla_rx(struct batadv_priv *bat_priv, |
69 | struct sk_buff *skb, unsigned short vid, | |
70 | bool is_bcast) | |
7a5cc242 | 71 | { |
4b426b10 | 72 | return false; |
7a5cc242 SW |
73 | } |
74 | ||
4b426b10 SE |
75 | static inline bool batadv_bla_tx(struct batadv_priv *bat_priv, |
76 | struct sk_buff *skb, unsigned short vid) | |
7a5cc242 | 77 | { |
4b426b10 | 78 | return false; |
7a5cc242 SW |
79 | } |
80 | ||
4b426b10 SE |
81 | static inline bool batadv_bla_is_backbone_gw(struct sk_buff *skb, |
82 | struct batadv_orig_node *orig_node, | |
83 | int hdr_size) | |
7a5cc242 | 84 | { |
4b426b10 | 85 | return false; |
7a5cc242 SW |
86 | } |
87 | ||
08adf151 SE |
88 | static inline int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, |
89 | void *offset) | |
7a5cc242 SW |
90 | { |
91 | return 0; | |
92 | } | |
93 | ||
536a23f1 SW |
94 | static inline int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, |
95 | void *offset) | |
96 | { | |
97 | return 0; | |
98 | } | |
99 | ||
cfd4f757 | 100 | static inline bool batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, |
6b5e971a | 101 | u8 *orig, unsigned short vid) |
7a5cc242 | 102 | { |
cfd4f757 | 103 | return false; |
7a5cc242 SW |
104 | } |
105 | ||
4b426b10 | 106 | static inline bool |
56303d34 | 107 | batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, |
004e86fc | 108 | struct sk_buff *skb) |
7a5cc242 | 109 | { |
4b426b10 | 110 | return false; |
7a5cc242 SW |
111 | } |
112 | ||
08adf151 | 113 | static inline void |
56303d34 SE |
114 | batadv_bla_update_orig_address(struct batadv_priv *bat_priv, |
115 | struct batadv_hard_iface *primary_if, | |
116 | struct batadv_hard_iface *oldif) | |
7a5cc242 SW |
117 | { |
118 | } | |
119 | ||
56303d34 | 120 | static inline int batadv_bla_init(struct batadv_priv *bat_priv) |
7a5cc242 SW |
121 | { |
122 | return 1; | |
123 | } | |
124 | ||
56303d34 | 125 | static inline void batadv_bla_free(struct batadv_priv *bat_priv) |
7a5cc242 SW |
126 | { |
127 | } | |
128 | ||
04f3f5bf AL |
129 | static inline int batadv_bla_claim_dump(struct sk_buff *msg, |
130 | struct netlink_callback *cb) | |
131 | { | |
132 | return -EOPNOTSUPP; | |
133 | } | |
134 | ||
ea4152e1 SW |
135 | static inline int batadv_bla_backbone_dump(struct sk_buff *msg, |
136 | struct netlink_callback *cb) | |
137 | { | |
138 | return -EOPNOTSUPP; | |
139 | } | |
140 | ||
00311de5 AP |
141 | static inline |
142 | bool batadv_bla_check_claim(struct batadv_priv *bat_priv, u8 *addr, | |
143 | unsigned short vid) | |
144 | { | |
145 | return true; | |
146 | } | |
147 | ||
7a5cc242 | 148 | #endif /* ifdef CONFIG_BATMAN_ADV_BLA */ |
23721387 SW |
149 | |
150 | #endif /* ifndef _NET_BATMAN_ADV_BLA_H_ */ |