diff options
| -rw-r--r-- | net/batman-adv/Kconfig | 12 | ||||
| -rw-r--r-- | net/batman-adv/Makefile | 2 | ||||
| -rw-r--r-- | net/batman-adv/bat_debugfs.c | 7 | ||||
| -rw-r--r-- | net/batman-adv/bat_sysfs.c | 4 | ||||
| -rw-r--r-- | net/batman-adv/bridge_loop_avoidance.h | 57 | ||||
| -rw-r--r-- | net/batman-adv/soft-interface.c | 4 | ||||
| -rw-r--r-- | net/batman-adv/types.h | 8 |
7 files changed, 89 insertions, 5 deletions
diff --git a/net/batman-adv/Kconfig b/net/batman-adv/Kconfig index 6ff977c1f3bc..53f5244e28f8 100644 --- a/net/batman-adv/Kconfig +++ b/net/batman-adv/Kconfig | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | config BATMAN_ADV | 5 | config BATMAN_ADV |
| 6 | tristate "B.A.T.M.A.N. Advanced Meshing Protocol" | 6 | tristate "B.A.T.M.A.N. Advanced Meshing Protocol" |
| 7 | depends on NET && INET | 7 | depends on NET |
| 8 | select CRC16 | 8 | select CRC16 |
| 9 | default n | 9 | default n |
| 10 | help | 10 | help |
| @@ -14,6 +14,16 @@ config BATMAN_ADV | |||
| 14 | http://www.open-mesh.org/ for more information and user space | 14 | http://www.open-mesh.org/ for more information and user space |
| 15 | tools. | 15 | tools. |
| 16 | 16 | ||
| 17 | config BATMAN_ADV_BLA | ||
| 18 | bool "Bridge Loop Avoidance" | ||
| 19 | depends on BATMAN_ADV && INET | ||
| 20 | default y | ||
| 21 | help | ||
| 22 | This option enables BLA (Bridge Loop Avoidance), a mechanism | ||
| 23 | to avoid Ethernet frames looping when mesh nodes are connected | ||
| 24 | to both the same LAN and the same mesh. If you will never use | ||
| 25 | more than one mesh node in the same LAN, you can safely remove | ||
| 26 | this feature and save some space. | ||
| 17 | 27 | ||
| 18 | config BATMAN_ADV_DEBUG | 28 | config BATMAN_ADV_DEBUG |
| 19 | bool "B.A.T.M.A.N. debugging" | 29 | bool "B.A.T.M.A.N. debugging" |
diff --git a/net/batman-adv/Makefile b/net/batman-adv/Makefile index 94b67fd81bf7..6d5c1940667d 100644 --- a/net/batman-adv/Makefile +++ b/net/batman-adv/Makefile | |||
| @@ -23,7 +23,7 @@ batman-adv-y += bat_debugfs.o | |||
| 23 | batman-adv-y += bat_iv_ogm.o | 23 | batman-adv-y += bat_iv_ogm.o |
| 24 | batman-adv-y += bat_sysfs.o | 24 | batman-adv-y += bat_sysfs.o |
| 25 | batman-adv-y += bitarray.o | 25 | batman-adv-y += bitarray.o |
| 26 | batman-adv-y += bridge_loop_avoidance.o | 26 | batman-adv-$(CONFIG_BATMAN_ADV_BLA) += bridge_loop_avoidance.o |
| 27 | batman-adv-y += gateway_client.o | 27 | batman-adv-y += gateway_client.o |
| 28 | batman-adv-y += gateway_common.o | 28 | batman-adv-y += gateway_common.o |
| 29 | batman-adv-y += hard-interface.o | 29 | batman-adv-y += hard-interface.o |
diff --git a/net/batman-adv/bat_debugfs.c b/net/batman-adv/bat_debugfs.c index 0e3517773a8b..916380c73ab7 100644 --- a/net/batman-adv/bat_debugfs.c +++ b/net/batman-adv/bat_debugfs.c | |||
| @@ -245,12 +245,13 @@ static int transtable_global_open(struct inode *inode, struct file *file) | |||
| 245 | return single_open(file, tt_global_seq_print_text, net_dev); | 245 | return single_open(file, tt_global_seq_print_text, net_dev); |
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | #ifdef CONFIG_BATMAN_ADV_BLA | ||
| 248 | static int bla_claim_table_open(struct inode *inode, struct file *file) | 249 | static int bla_claim_table_open(struct inode *inode, struct file *file) |
| 249 | { | 250 | { |
| 250 | struct net_device *net_dev = (struct net_device *)inode->i_private; | 251 | struct net_device *net_dev = (struct net_device *)inode->i_private; |
| 251 | return single_open(file, bla_claim_table_seq_print_text, net_dev); | 252 | return single_open(file, bla_claim_table_seq_print_text, net_dev); |
| 252 | } | 253 | } |
| 253 | 254 | #endif | |
| 254 | 255 | ||
| 255 | static int transtable_local_open(struct inode *inode, struct file *file) | 256 | static int transtable_local_open(struct inode *inode, struct file *file) |
| 256 | { | 257 | { |
| @@ -285,7 +286,9 @@ static BAT_DEBUGINFO(routing_algos, S_IRUGO, bat_algorithms_open); | |||
| 285 | static BAT_DEBUGINFO(originators, S_IRUGO, originators_open); | 286 | static BAT_DEBUGINFO(originators, S_IRUGO, originators_open); |
| 286 | static BAT_DEBUGINFO(gateways, S_IRUGO, gateways_open); | 287 | static BAT_DEBUGINFO(gateways, S_IRUGO, gateways_open); |
| 287 | static BAT_DEBUGINFO(transtable_global, S_IRUGO, transtable_global_open); | 288 | static BAT_DEBUGINFO(transtable_global, S_IRUGO, transtable_global_open); |
| 289 | #ifdef CONFIG_BATMAN_ADV_BLA | ||
| 288 | static BAT_DEBUGINFO(bla_claim_table, S_IRUGO, bla_claim_table_open); | 290 | static BAT_DEBUGINFO(bla_claim_table, S_IRUGO, bla_claim_table_open); |
| 291 | #endif | ||
| 289 | static BAT_DEBUGINFO(transtable_local, S_IRUGO, transtable_local_open); | 292 | static BAT_DEBUGINFO(transtable_local, S_IRUGO, transtable_local_open); |
| 290 | static BAT_DEBUGINFO(vis_data, S_IRUGO, vis_data_open); | 293 | static BAT_DEBUGINFO(vis_data, S_IRUGO, vis_data_open); |
| 291 | 294 | ||
| @@ -293,7 +296,9 @@ static struct bat_debuginfo *mesh_debuginfos[] = { | |||
| 293 | &bat_debuginfo_originators, | 296 | &bat_debuginfo_originators, |
| 294 | &bat_debuginfo_gateways, | 297 | &bat_debuginfo_gateways, |
| 295 | &bat_debuginfo_transtable_global, | 298 | &bat_debuginfo_transtable_global, |
| 299 | #ifdef CONFIG_BATMAN_ADV_BLA | ||
| 296 | &bat_debuginfo_bla_claim_table, | 300 | &bat_debuginfo_bla_claim_table, |
| 301 | #endif | ||
| 297 | &bat_debuginfo_transtable_local, | 302 | &bat_debuginfo_transtable_local, |
| 298 | &bat_debuginfo_vis_data, | 303 | &bat_debuginfo_vis_data, |
| 299 | NULL, | 304 | NULL, |
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c index 824bfe710687..c6efd687ca75 100644 --- a/net/batman-adv/bat_sysfs.c +++ b/net/batman-adv/bat_sysfs.c | |||
| @@ -386,7 +386,9 @@ static ssize_t store_gw_bwidth(struct kobject *kobj, struct attribute *attr, | |||
| 386 | 386 | ||
| 387 | BAT_ATTR_BOOL(aggregated_ogms, S_IRUGO | S_IWUSR, NULL); | 387 | BAT_ATTR_BOOL(aggregated_ogms, S_IRUGO | S_IWUSR, NULL); |
| 388 | BAT_ATTR_BOOL(bonding, S_IRUGO | S_IWUSR, NULL); | 388 | BAT_ATTR_BOOL(bonding, S_IRUGO | S_IWUSR, NULL); |
| 389 | #ifdef CONFIG_BATMAN_ADV_BLA | ||
| 389 | BAT_ATTR_BOOL(bridge_loop_avoidance, S_IRUGO | S_IWUSR, NULL); | 390 | BAT_ATTR_BOOL(bridge_loop_avoidance, S_IRUGO | S_IWUSR, NULL); |
| 391 | #endif | ||
| 390 | BAT_ATTR_BOOL(fragmentation, S_IRUGO | S_IWUSR, update_min_mtu); | 392 | BAT_ATTR_BOOL(fragmentation, S_IRUGO | S_IWUSR, update_min_mtu); |
| 391 | BAT_ATTR_BOOL(ap_isolation, S_IRUGO | S_IWUSR, NULL); | 393 | BAT_ATTR_BOOL(ap_isolation, S_IRUGO | S_IWUSR, NULL); |
| 392 | static BAT_ATTR(vis_mode, S_IRUGO | S_IWUSR, show_vis_mode, store_vis_mode); | 394 | static BAT_ATTR(vis_mode, S_IRUGO | S_IWUSR, show_vis_mode, store_vis_mode); |
| @@ -405,7 +407,9 @@ BAT_ATTR_UINT(log_level, S_IRUGO | S_IWUSR, 0, 15, NULL); | |||
| 405 | static struct bat_attribute *mesh_attrs[] = { | 407 | static struct bat_attribute *mesh_attrs[] = { |
| 406 | &bat_attr_aggregated_ogms, | 408 | &bat_attr_aggregated_ogms, |
| 407 | &bat_attr_bonding, | 409 | &bat_attr_bonding, |
| 410 | #ifdef CONFIG_BATMAN_ADV_BLA | ||
| 408 | &bat_attr_bridge_loop_avoidance, | 411 | &bat_attr_bridge_loop_avoidance, |
| 412 | #endif | ||
| 409 | &bat_attr_fragmentation, | 413 | &bat_attr_fragmentation, |
| 410 | &bat_attr_ap_isolation, | 414 | &bat_attr_ap_isolation, |
| 411 | &bat_attr_vis_mode, | 415 | &bat_attr_vis_mode, |
diff --git a/net/batman-adv/bridge_loop_avoidance.h b/net/batman-adv/bridge_loop_avoidance.h index 9468c245121c..4a8e4fc766bc 100644 --- a/net/batman-adv/bridge_loop_avoidance.h +++ b/net/batman-adv/bridge_loop_avoidance.h | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #ifndef _NET_BATMAN_ADV_BLA_H_ | 22 | #ifndef _NET_BATMAN_ADV_BLA_H_ |
| 23 | #define _NET_BATMAN_ADV_BLA_H_ | 23 | #define _NET_BATMAN_ADV_BLA_H_ |
| 24 | 24 | ||
| 25 | #ifdef CONFIG_BATMAN_ADV_BLA | ||
| 25 | int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid); | 26 | int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid); |
| 26 | int bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid); | 27 | int bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid); |
| 27 | int bla_is_backbone_gw(struct sk_buff *skb, | 28 | int bla_is_backbone_gw(struct sk_buff *skb, |
| @@ -37,5 +38,61 @@ int bla_init(struct bat_priv *bat_priv); | |||
| 37 | void bla_free(struct bat_priv *bat_priv); | 38 | void bla_free(struct bat_priv *bat_priv); |
| 38 | 39 | ||
| 39 | #define BLA_CRC_INIT 0 | 40 | #define BLA_CRC_INIT 0 |
| 41 | #else /* ifdef CONFIG_BATMAN_ADV_BLA */ | ||
| 42 | |||
| 43 | static inline int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, | ||
| 44 | short vid) | ||
| 45 | { | ||
| 46 | return 0; | ||
| 47 | } | ||
| 48 | |||
| 49 | static inline int bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, | ||
| 50 | short vid) | ||
| 51 | { | ||
| 52 | return 0; | ||
| 53 | } | ||
| 54 | |||
| 55 | static inline int bla_is_backbone_gw(struct sk_buff *skb, | ||
| 56 | struct orig_node *orig_node, | ||
| 57 | int hdr_size) | ||
| 58 | { | ||
| 59 | return 0; | ||
| 60 | } | ||
| 61 | |||
| 62 | static inline int bla_claim_table_seq_print_text(struct seq_file *seq, | ||
| 63 | void *offset) | ||
| 64 | { | ||
| 65 | return 0; | ||
| 66 | } | ||
| 67 | |||
| 68 | static inline int bla_is_backbone_gw_orig(struct bat_priv *bat_priv, | ||
| 69 | uint8_t *orig) | ||
| 70 | { | ||
| 71 | return 0; | ||
| 72 | } | ||
| 73 | |||
| 74 | static inline int bla_check_bcast_duplist(struct bat_priv *bat_priv, | ||
| 75 | struct bcast_packet *bcast_packet, | ||
| 76 | int hdr_size) | ||
| 77 | { | ||
| 78 | return 0; | ||
| 79 | } | ||
| 80 | |||
| 81 | static inline void bla_update_orig_address(struct bat_priv *bat_priv, | ||
| 82 | struct hard_iface *primary_if, | ||
| 83 | struct hard_iface *oldif) | ||
| 84 | { | ||
| 85 | } | ||
| 86 | |||
| 87 | static inline int bla_init(struct bat_priv *bat_priv) | ||
| 88 | { | ||
| 89 | return 1; | ||
| 90 | } | ||
| 91 | |||
| 92 | static inline void bla_free(struct bat_priv *bat_priv) | ||
| 93 | { | ||
| 94 | } | ||
| 95 | |||
| 96 | #endif /* ifdef CONFIG_BATMAN_ADV_BLA */ | ||
| 40 | 97 | ||
| 41 | #endif /* ifndef _NET_BATMAN_ADV_BLA_H_ */ | 98 | #endif /* ifndef _NET_BATMAN_ADV_BLA_H_ */ |
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index 10ab49aa568f..efe0fbaadcd6 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
| @@ -134,7 +134,7 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface) | |||
| 134 | 0x00}; | 134 | 0x00}; |
| 135 | unsigned int header_len = 0; | 135 | unsigned int header_len = 0; |
| 136 | int data_len = skb->len, ret; | 136 | int data_len = skb->len, ret; |
| 137 | short vid = -1; | 137 | short vid __maybe_unused = -1; |
| 138 | bool do_bcast = false; | 138 | bool do_bcast = false; |
| 139 | 139 | ||
| 140 | if (atomic_read(&bat_priv->mesh_state) != MESH_ACTIVE) | 140 | if (atomic_read(&bat_priv->mesh_state) != MESH_ACTIVE) |
| @@ -256,7 +256,7 @@ void interface_rx(struct net_device *soft_iface, | |||
| 256 | struct bat_priv *bat_priv = netdev_priv(soft_iface); | 256 | struct bat_priv *bat_priv = netdev_priv(soft_iface); |
| 257 | struct ethhdr *ethhdr; | 257 | struct ethhdr *ethhdr; |
| 258 | struct vlan_ethhdr *vhdr; | 258 | struct vlan_ethhdr *vhdr; |
| 259 | short vid = -1; | 259 | short vid __maybe_unused = -1; |
| 260 | 260 | ||
| 261 | /* check if enough space is available for pulling, and pull */ | 261 | /* check if enough space is available for pulling, and pull */ |
| 262 | if (!pskb_may_pull(skb, hdr_size)) | 262 | if (!pskb_may_pull(skb, hdr_size)) |
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h index 7f7f610ea1d1..a5b1a6333def 100644 --- a/net/batman-adv/types.h +++ b/net/batman-adv/types.h | |||
| @@ -140,11 +140,13 @@ struct neigh_node { | |||
| 140 | spinlock_t tq_lock; /* protects: tq_recv, tq_index */ | 140 | spinlock_t tq_lock; /* protects: tq_recv, tq_index */ |
| 141 | }; | 141 | }; |
| 142 | 142 | ||
| 143 | #ifdef CONFIG_BATMAN_ADV_BLA | ||
| 143 | struct bcast_duplist_entry { | 144 | struct bcast_duplist_entry { |
| 144 | uint8_t orig[ETH_ALEN]; | 145 | uint8_t orig[ETH_ALEN]; |
| 145 | uint16_t crc; | 146 | uint16_t crc; |
| 146 | unsigned long entrytime; | 147 | unsigned long entrytime; |
| 147 | }; | 148 | }; |
| 149 | #endif | ||
| 148 | 150 | ||
| 149 | struct bat_priv { | 151 | struct bat_priv { |
| 150 | atomic_t mesh_state; | 152 | atomic_t mesh_state; |
| @@ -186,14 +188,18 @@ struct bat_priv { | |||
| 186 | struct hashtable_t *orig_hash; | 188 | struct hashtable_t *orig_hash; |
| 187 | struct hashtable_t *tt_local_hash; | 189 | struct hashtable_t *tt_local_hash; |
| 188 | struct hashtable_t *tt_global_hash; | 190 | struct hashtable_t *tt_global_hash; |
| 191 | #ifdef CONFIG_BATMAN_ADV_BLA | ||
| 189 | struct hashtable_t *claim_hash; | 192 | struct hashtable_t *claim_hash; |
| 190 | struct hashtable_t *backbone_hash; | 193 | struct hashtable_t *backbone_hash; |
| 194 | #endif | ||
| 191 | struct list_head tt_req_list; /* list of pending tt_requests */ | 195 | struct list_head tt_req_list; /* list of pending tt_requests */ |
| 192 | struct list_head tt_roam_list; | 196 | struct list_head tt_roam_list; |
| 193 | struct hashtable_t *vis_hash; | 197 | struct hashtable_t *vis_hash; |
| 198 | #ifdef CONFIG_BATMAN_ADV_BLA | ||
| 194 | struct bcast_duplist_entry bcast_duplist[DUPLIST_SIZE]; | 199 | struct bcast_duplist_entry bcast_duplist[DUPLIST_SIZE]; |
| 195 | int bcast_duplist_curr; | 200 | int bcast_duplist_curr; |
| 196 | struct bla_claim_dst claim_dest; | 201 | struct bla_claim_dst claim_dest; |
| 202 | #endif | ||
| 197 | spinlock_t forw_bat_list_lock; /* protects forw_bat_list */ | 203 | spinlock_t forw_bat_list_lock; /* protects forw_bat_list */ |
| 198 | spinlock_t forw_bcast_list_lock; /* protects */ | 204 | spinlock_t forw_bcast_list_lock; /* protects */ |
| 199 | spinlock_t tt_changes_list_lock; /* protects tt_changes */ | 205 | spinlock_t tt_changes_list_lock; /* protects tt_changes */ |
| @@ -261,6 +267,7 @@ struct tt_orig_list_entry { | |||
| 261 | struct hlist_node list; | 267 | struct hlist_node list; |
| 262 | }; | 268 | }; |
| 263 | 269 | ||
| 270 | #ifdef CONFIG_BATMAN_ADV_BLA | ||
| 264 | struct backbone_gw { | 271 | struct backbone_gw { |
| 265 | uint8_t orig[ETH_ALEN]; | 272 | uint8_t orig[ETH_ALEN]; |
| 266 | short vid; /* used VLAN ID */ | 273 | short vid; /* used VLAN ID */ |
| @@ -282,6 +289,7 @@ struct claim { | |||
| 282 | atomic_t refcount; | 289 | atomic_t refcount; |
| 283 | struct hlist_node hash_entry; | 290 | struct hlist_node hash_entry; |
| 284 | }; | 291 | }; |
| 292 | #endif | ||
| 285 | 293 | ||
| 286 | struct tt_change_node { | 294 | struct tt_change_node { |
| 287 | struct list_head list; | 295 | struct list_head list; |
