1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2011-2019 B.A.T.M.A.N. contributors:
7 #ifndef _NET_BATMAN_ADV_BLA_H_
8 #define _NET_BATMAN_ADV_BLA_H_
12 #include <linux/compiler.h>
13 #include <linux/stddef.h>
14 #include <linux/types.h>
17 struct netlink_callback;
22 * batadv_bla_is_loopdetect_mac() - check if the mac address is from a loop
23 * detect frame sent by bridge loop avoidance
24 * @mac: mac address to check
26 * Return: true if the it looks like a loop detect frame
27 * (mac starts with BA:BE), false otherwise
29 static inline bool batadv_bla_is_loopdetect_mac(const uint8_t *mac)
31 if (mac[0] == 0xba && mac[1] == 0xbe)
37 #ifdef CONFIG_BATMAN_ADV_BLA
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,
42 bool batadv_bla_is_backbone_gw(struct sk_buff *skb,
43 struct batadv_orig_node *orig_node,
45 int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset);
46 int batadv_bla_claim_dump(struct sk_buff *msg, struct netlink_callback *cb);
47 int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq,
49 int batadv_bla_backbone_dump(struct sk_buff *msg, struct netlink_callback *cb);
50 bool batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, u8 *orig,
52 bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
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);
57 void batadv_bla_status_update(struct net_device *net_dev);
58 int batadv_bla_init(struct batadv_priv *bat_priv);
59 void batadv_bla_free(struct batadv_priv *bat_priv);
60 int batadv_bla_claim_dump(struct sk_buff *msg, struct netlink_callback *cb);
61 #ifdef CONFIG_BATMAN_ADV_DAT
62 bool batadv_bla_check_claim(struct batadv_priv *bat_priv, u8 *addr,
65 #define BATADV_BLA_CRC_INIT 0
66 #else /* ifdef CONFIG_BATMAN_ADV_BLA */
68 static inline bool batadv_bla_rx(struct batadv_priv *bat_priv,
69 struct sk_buff *skb, unsigned short vid,
75 static inline bool batadv_bla_tx(struct batadv_priv *bat_priv,
76 struct sk_buff *skb, unsigned short vid)
81 static inline bool batadv_bla_is_backbone_gw(struct sk_buff *skb,
82 struct batadv_orig_node *orig_node,
88 static inline int batadv_bla_claim_table_seq_print_text(struct seq_file *seq,
94 static inline int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq,
100 static inline bool batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv,
101 u8 *orig, unsigned short vid)
107 batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
114 batadv_bla_update_orig_address(struct batadv_priv *bat_priv,
115 struct batadv_hard_iface *primary_if,
116 struct batadv_hard_iface *oldif)
120 static inline int batadv_bla_init(struct batadv_priv *bat_priv)
125 static inline void batadv_bla_free(struct batadv_priv *bat_priv)
129 static inline int batadv_bla_claim_dump(struct sk_buff *msg,
130 struct netlink_callback *cb)
135 static inline int batadv_bla_backbone_dump(struct sk_buff *msg,
136 struct netlink_callback *cb)
142 bool batadv_bla_check_claim(struct batadv_priv *bat_priv, u8 *addr,
148 #endif /* ifdef CONFIG_BATMAN_ADV_BLA */
150 #endif /* ifndef _NET_BATMAN_ADV_BLA_H_ */