WIP FPC-III support
[linux/fpc-iii.git] / net / batman-adv / bridge_loop_avoidance.h
blob7dc6d357192523501de00d234910623e9b119b4b
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2011-2020 B.A.T.M.A.N. contributors:
4 * Simon Wunderlich
5 */
7 #ifndef _NET_BATMAN_ADV_BLA_H_
8 #define _NET_BATMAN_ADV_BLA_H_
10 #include "main.h"
12 #include <linux/compiler.h>
13 #include <linux/netdevice.h>
14 #include <linux/netlink.h>
15 #include <linux/skbuff.h>
16 #include <linux/stddef.h>
17 #include <linux/types.h>
19 /**
20 * batadv_bla_is_loopdetect_mac() - check if the mac address is from a loop
21 * detect frame sent by bridge loop avoidance
22 * @mac: mac address to check
24 * Return: true if the it looks like a loop detect frame
25 * (mac starts with BA:BE), false otherwise
27 static inline bool batadv_bla_is_loopdetect_mac(const uint8_t *mac)
29 if (mac[0] == 0xba && mac[1] == 0xbe)
30 return true;
32 return false;
35 #ifdef CONFIG_BATMAN_ADV_BLA
36 bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
37 unsigned short vid, int packet_type);
38 bool batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb,
39 unsigned short vid);
40 bool batadv_bla_is_backbone_gw(struct sk_buff *skb,
41 struct batadv_orig_node *orig_node,
42 int hdr_size);
43 int batadv_bla_claim_dump(struct sk_buff *msg, struct netlink_callback *cb);
44 int batadv_bla_backbone_dump(struct sk_buff *msg, struct netlink_callback *cb);
45 bool batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, u8 *orig,
46 unsigned short vid);
47 bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
48 struct sk_buff *skb);
49 void batadv_bla_update_orig_address(struct batadv_priv *bat_priv,
50 struct batadv_hard_iface *primary_if,
51 struct batadv_hard_iface *oldif);
52 void batadv_bla_status_update(struct net_device *net_dev);
53 int batadv_bla_init(struct batadv_priv *bat_priv);
54 void batadv_bla_free(struct batadv_priv *bat_priv);
55 int batadv_bla_claim_dump(struct sk_buff *msg, struct netlink_callback *cb);
56 #ifdef CONFIG_BATMAN_ADV_DAT
57 bool batadv_bla_check_claim(struct batadv_priv *bat_priv, u8 *addr,
58 unsigned short vid);
59 #endif
60 #define BATADV_BLA_CRC_INIT 0
61 #else /* ifdef CONFIG_BATMAN_ADV_BLA */
63 static inline bool batadv_bla_rx(struct batadv_priv *bat_priv,
64 struct sk_buff *skb, unsigned short vid,
65 int packet_type)
67 return false;
70 static inline bool batadv_bla_tx(struct batadv_priv *bat_priv,
71 struct sk_buff *skb, unsigned short vid)
73 return false;
76 static inline bool batadv_bla_is_backbone_gw(struct sk_buff *skb,
77 struct batadv_orig_node *orig_node,
78 int hdr_size)
80 return false;
83 static inline bool batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv,
84 u8 *orig, unsigned short vid)
86 return false;
89 static inline bool
90 batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
91 struct sk_buff *skb)
93 return false;
96 static inline void
97 batadv_bla_update_orig_address(struct batadv_priv *bat_priv,
98 struct batadv_hard_iface *primary_if,
99 struct batadv_hard_iface *oldif)
103 static inline int batadv_bla_init(struct batadv_priv *bat_priv)
105 return 1;
108 static inline void batadv_bla_free(struct batadv_priv *bat_priv)
112 static inline int batadv_bla_claim_dump(struct sk_buff *msg,
113 struct netlink_callback *cb)
115 return -EOPNOTSUPP;
118 static inline int batadv_bla_backbone_dump(struct sk_buff *msg,
119 struct netlink_callback *cb)
121 return -EOPNOTSUPP;
124 static inline
125 bool batadv_bla_check_claim(struct batadv_priv *bat_priv, u8 *addr,
126 unsigned short vid)
128 return true;
131 #endif /* ifdef CONFIG_BATMAN_ADV_BLA */
133 #endif /* ifndef _NET_BATMAN_ADV_BLA_H_ */