1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2011-2020 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/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>
21 * batadv_bla_is_loopdetect_mac() - check if the mac address is from a loop
22 * detect frame sent by bridge loop avoidance
23 * @mac: mac address to check
25 * Return: true if the it looks like a loop detect frame
26 * (mac starts with BA:BE), false otherwise
28 static inline bool batadv_bla_is_loopdetect_mac(const uint8_t *mac
)
30 if (mac
[0] == 0xba && mac
[1] == 0xbe)
36 #ifdef CONFIG_BATMAN_ADV_BLA
37 bool batadv_bla_rx(struct batadv_priv
*bat_priv
, struct sk_buff
*skb
,
38 unsigned short vid
, bool is_bcast
);
39 bool batadv_bla_tx(struct batadv_priv
*bat_priv
, struct sk_buff
*skb
,
41 bool batadv_bla_is_backbone_gw(struct sk_buff
*skb
,
42 struct batadv_orig_node
*orig_node
,
44 int batadv_bla_claim_table_seq_print_text(struct seq_file
*seq
, void *offset
);
45 int batadv_bla_claim_dump(struct sk_buff
*msg
, struct netlink_callback
*cb
);
46 int batadv_bla_backbone_table_seq_print_text(struct seq_file
*seq
,
48 int batadv_bla_backbone_dump(struct sk_buff
*msg
, struct netlink_callback
*cb
);
49 bool batadv_bla_is_backbone_gw_orig(struct batadv_priv
*bat_priv
, u8
*orig
,
51 bool batadv_bla_check_bcast_duplist(struct batadv_priv
*bat_priv
,
53 void batadv_bla_update_orig_address(struct batadv_priv
*bat_priv
,
54 struct batadv_hard_iface
*primary_if
,
55 struct batadv_hard_iface
*oldif
);
56 void batadv_bla_status_update(struct net_device
*net_dev
);
57 int batadv_bla_init(struct batadv_priv
*bat_priv
);
58 void batadv_bla_free(struct batadv_priv
*bat_priv
);
59 int batadv_bla_claim_dump(struct sk_buff
*msg
, struct netlink_callback
*cb
);
60 #ifdef CONFIG_BATMAN_ADV_DAT
61 bool batadv_bla_check_claim(struct batadv_priv
*bat_priv
, u8
*addr
,
64 #define BATADV_BLA_CRC_INIT 0
65 #else /* ifdef CONFIG_BATMAN_ADV_BLA */
67 static inline bool batadv_bla_rx(struct batadv_priv
*bat_priv
,
68 struct sk_buff
*skb
, unsigned short vid
,
74 static inline bool batadv_bla_tx(struct batadv_priv
*bat_priv
,
75 struct sk_buff
*skb
, unsigned short vid
)
80 static inline bool batadv_bla_is_backbone_gw(struct sk_buff
*skb
,
81 struct batadv_orig_node
*orig_node
,
87 static inline int batadv_bla_claim_table_seq_print_text(struct seq_file
*seq
,
93 static inline int batadv_bla_backbone_table_seq_print_text(struct seq_file
*seq
,
99 static inline bool batadv_bla_is_backbone_gw_orig(struct batadv_priv
*bat_priv
,
100 u8
*orig
, unsigned short vid
)
106 batadv_bla_check_bcast_duplist(struct batadv_priv
*bat_priv
,
113 batadv_bla_update_orig_address(struct batadv_priv
*bat_priv
,
114 struct batadv_hard_iface
*primary_if
,
115 struct batadv_hard_iface
*oldif
)
119 static inline int batadv_bla_init(struct batadv_priv
*bat_priv
)
124 static inline void batadv_bla_free(struct batadv_priv
*bat_priv
)
128 static inline int batadv_bla_claim_dump(struct sk_buff
*msg
,
129 struct netlink_callback
*cb
)
134 static inline int batadv_bla_backbone_dump(struct sk_buff
*msg
,
135 struct netlink_callback
*cb
)
141 bool batadv_bla_check_claim(struct batadv_priv
*bat_priv
, u8
*addr
,
147 #endif /* ifdef CONFIG_BATMAN_ADV_BLA */
149 #endif /* ifndef _NET_BATMAN_ADV_BLA_H_ */