diff options
-rw-r--r-- | net/batman-adv/bridge_loop_avoidance.c | 19 | ||||
-rw-r--r-- | net/batman-adv/bridge_loop_avoidance.h | 10 | ||||
-rw-r--r-- | net/batman-adv/translation-table.c | 41 |
3 files changed, 27 insertions, 43 deletions
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index 3b3867db88a7..28eb5e6d0a02 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c | |||
@@ -1315,12 +1315,14 @@ out: | |||
1315 | 1315 | ||
1316 | /* @bat_priv: the bat priv with all the soft interface information | 1316 | /* @bat_priv: the bat priv with all the soft interface information |
1317 | * @orig: originator mac address | 1317 | * @orig: originator mac address |
1318 | * @vid: VLAN identifier | ||
1318 | * | 1319 | * |
1319 | * check if the originator is a gateway for any VLAN ID. | 1320 | * Check if the originator is a gateway for the VLAN identified by vid. |
1320 | * | 1321 | * |
1321 | * returns 1 if it is found, 0 otherwise | 1322 | * Returns true if orig is a backbone for this vid, false otherwise. |
1322 | */ | 1323 | */ |
1323 | int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig) | 1324 | bool batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig, |
1325 | unsigned short vid) | ||
1324 | { | 1326 | { |
1325 | struct batadv_hashtable *hash = bat_priv->bla.backbone_hash; | 1327 | struct batadv_hashtable *hash = bat_priv->bla.backbone_hash; |
1326 | struct hlist_head *head; | 1328 | struct hlist_head *head; |
@@ -1328,25 +1330,26 @@ int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig) | |||
1328 | int i; | 1330 | int i; |
1329 | 1331 | ||
1330 | if (!atomic_read(&bat_priv->bridge_loop_avoidance)) | 1332 | if (!atomic_read(&bat_priv->bridge_loop_avoidance)) |
1331 | return 0; | 1333 | return false; |
1332 | 1334 | ||
1333 | if (!hash) | 1335 | if (!hash) |
1334 | return 0; | 1336 | return false; |
1335 | 1337 | ||
1336 | for (i = 0; i < hash->size; i++) { | 1338 | for (i = 0; i < hash->size; i++) { |
1337 | head = &hash->table[i]; | 1339 | head = &hash->table[i]; |
1338 | 1340 | ||
1339 | rcu_read_lock(); | 1341 | rcu_read_lock(); |
1340 | hlist_for_each_entry_rcu(backbone_gw, head, hash_entry) { | 1342 | hlist_for_each_entry_rcu(backbone_gw, head, hash_entry) { |
1341 | if (batadv_compare_eth(backbone_gw->orig, orig)) { | 1343 | if (batadv_compare_eth(backbone_gw->orig, orig) && |
1344 | backbone_gw->vid == vid) { | ||
1342 | rcu_read_unlock(); | 1345 | rcu_read_unlock(); |
1343 | return 1; | 1346 | return true; |
1344 | } | 1347 | } |
1345 | } | 1348 | } |
1346 | rcu_read_unlock(); | 1349 | rcu_read_unlock(); |
1347 | } | 1350 | } |
1348 | 1351 | ||
1349 | return 0; | 1352 | return false; |
1350 | } | 1353 | } |
1351 | 1354 | ||
1352 | 1355 | ||
diff --git a/net/batman-adv/bridge_loop_avoidance.h b/net/batman-adv/bridge_loop_avoidance.h index 4b102e71e5bd..da173e760e77 100644 --- a/net/batman-adv/bridge_loop_avoidance.h +++ b/net/batman-adv/bridge_loop_avoidance.h | |||
@@ -30,7 +30,8 @@ int batadv_bla_is_backbone_gw(struct sk_buff *skb, | |||
30 | int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset); | 30 | int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset); |
31 | int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, | 31 | int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, |
32 | void *offset); | 32 | void *offset); |
33 | int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig); | 33 | bool batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig, |
34 | unsigned short vid); | ||
34 | int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, | 35 | int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, |
35 | struct sk_buff *skb); | 36 | struct sk_buff *skb); |
36 | void batadv_bla_update_orig_address(struct batadv_priv *bat_priv, | 37 | void batadv_bla_update_orig_address(struct batadv_priv *bat_priv, |
@@ -74,10 +75,11 @@ static inline int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, | |||
74 | return 0; | 75 | return 0; |
75 | } | 76 | } |
76 | 77 | ||
77 | static inline int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, | 78 | static inline bool batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, |
78 | uint8_t *orig) | 79 | uint8_t *orig, |
80 | unsigned short vid) | ||
79 | { | 81 | { |
80 | return 0; | 82 | return false; |
81 | } | 83 | } |
82 | 84 | ||
83 | static inline int | 85 | static inline int |
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 4c313ff8b12f..7731eaed737d 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -1153,6 +1153,10 @@ static bool batadv_tt_global_add(struct batadv_priv *bat_priv, | |||
1153 | struct batadv_tt_common_entry *common; | 1153 | struct batadv_tt_common_entry *common; |
1154 | uint16_t local_flags; | 1154 | uint16_t local_flags; |
1155 | 1155 | ||
1156 | /* ignore global entries from backbone nodes */ | ||
1157 | if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, vid)) | ||
1158 | return true; | ||
1159 | |||
1156 | tt_global_entry = batadv_tt_global_hash_find(bat_priv, tt_addr, vid); | 1160 | tt_global_entry = batadv_tt_global_hash_find(bat_priv, tt_addr, vid); |
1157 | tt_local_entry = batadv_tt_local_hash_find(bat_priv, tt_addr, vid); | 1161 | tt_local_entry = batadv_tt_local_hash_find(bat_priv, tt_addr, vid); |
1158 | 1162 | ||
@@ -2135,7 +2139,8 @@ static bool batadv_tt_global_check_crc(struct batadv_orig_node *orig_node, | |||
2135 | * the CRC as we ignore all the global entries over it | 2139 | * the CRC as we ignore all the global entries over it |
2136 | */ | 2140 | */ |
2137 | if (batadv_bla_is_backbone_gw_orig(orig_node->bat_priv, | 2141 | if (batadv_bla_is_backbone_gw_orig(orig_node->bat_priv, |
2138 | orig_node->orig)) | 2142 | orig_node->orig, |
2143 | ntohs(tt_vlan_tmp->vid))) | ||
2139 | continue; | 2144 | continue; |
2140 | 2145 | ||
2141 | vlan = batadv_orig_node_vlan_get(orig_node, | 2146 | vlan = batadv_orig_node_vlan_get(orig_node, |
@@ -2183,7 +2188,8 @@ static void batadv_tt_global_update_crc(struct batadv_priv *bat_priv, | |||
2183 | /* if orig_node is a backbone node for this VLAN, don't compute | 2188 | /* if orig_node is a backbone node for this VLAN, don't compute |
2184 | * the CRC as we ignore all the global entries over it | 2189 | * the CRC as we ignore all the global entries over it |
2185 | */ | 2190 | */ |
2186 | if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig)) | 2191 | if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, |
2192 | vlan->vid)) | ||
2187 | continue; | 2193 | continue; |
2188 | 2194 | ||
2189 | crc = batadv_tt_global_crc(bat_priv, orig_node, vlan->vid); | 2195 | crc = batadv_tt_global_crc(bat_priv, orig_node, vlan->vid); |
@@ -2527,16 +2533,11 @@ static bool batadv_send_tt_response(struct batadv_priv *bat_priv, | |||
2527 | struct batadv_tvlv_tt_data *tt_data, | 2533 | struct batadv_tvlv_tt_data *tt_data, |
2528 | uint8_t *req_src, uint8_t *req_dst) | 2534 | uint8_t *req_src, uint8_t *req_dst) |
2529 | { | 2535 | { |
2530 | if (batadv_is_my_mac(bat_priv, req_dst)) { | 2536 | if (batadv_is_my_mac(bat_priv, req_dst)) |
2531 | /* don't answer backbone gws! */ | ||
2532 | if (batadv_bla_is_backbone_gw_orig(bat_priv, req_src)) | ||
2533 | return true; | ||
2534 | |||
2535 | return batadv_send_my_tt_response(bat_priv, tt_data, req_src); | 2537 | return batadv_send_my_tt_response(bat_priv, tt_data, req_src); |
2536 | } else { | 2538 | else |
2537 | return batadv_send_other_tt_response(bat_priv, tt_data, | 2539 | return batadv_send_other_tt_response(bat_priv, tt_data, |
2538 | req_src, req_dst); | 2540 | req_src, req_dst); |
2539 | } | ||
2540 | } | 2541 | } |
2541 | 2542 | ||
2542 | static void _batadv_tt_update_changes(struct batadv_priv *bat_priv, | 2543 | static void _batadv_tt_update_changes(struct batadv_priv *bat_priv, |
@@ -2668,10 +2669,6 @@ static void batadv_handle_tt_response(struct batadv_priv *bat_priv, | |||
2668 | resp_src, tt_data->ttvn, num_entries, | 2669 | resp_src, tt_data->ttvn, num_entries, |
2669 | (tt_data->flags & BATADV_TT_FULL_TABLE ? 'F' : '.')); | 2670 | (tt_data->flags & BATADV_TT_FULL_TABLE ? 'F' : '.')); |
2670 | 2671 | ||
2671 | /* we should have never asked a backbone gw */ | ||
2672 | if (batadv_bla_is_backbone_gw_orig(bat_priv, resp_src)) | ||
2673 | goto out; | ||
2674 | |||
2675 | orig_node = batadv_orig_hash_find(bat_priv, resp_src); | 2672 | orig_node = batadv_orig_hash_find(bat_priv, resp_src); |
2676 | if (!orig_node) | 2673 | if (!orig_node) |
2677 | goto out; | 2674 | goto out; |
@@ -3052,10 +3049,6 @@ static void batadv_tt_update_orig(struct batadv_priv *bat_priv, | |||
3052 | struct batadv_tvlv_tt_vlan_data *tt_vlan; | 3049 | struct batadv_tvlv_tt_vlan_data *tt_vlan; |
3053 | bool full_table = true; | 3050 | bool full_table = true; |
3054 | 3051 | ||
3055 | /* don't care about a backbone gateways updates. */ | ||
3056 | if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig)) | ||
3057 | return; | ||
3058 | |||
3059 | tt_vlan = (struct batadv_tvlv_tt_vlan_data *)tt_buff; | 3052 | tt_vlan = (struct batadv_tvlv_tt_vlan_data *)tt_buff; |
3060 | /* orig table not initialised AND first diff is in the OGM OR the ttvn | 3053 | /* orig table not initialised AND first diff is in the OGM OR the ttvn |
3061 | * increased by one -> we can apply the attached changes | 3054 | * increased by one -> we can apply the attached changes |
@@ -3177,13 +3170,6 @@ bool batadv_tt_add_temporary_global_entry(struct batadv_priv *bat_priv, | |||
3177 | { | 3170 | { |
3178 | bool ret = false; | 3171 | bool ret = false; |
3179 | 3172 | ||
3180 | /* if the originator is a backbone node (meaning it belongs to the same | ||
3181 | * LAN of this node) the temporary client must not be added because to | ||
3182 | * reach such destination the node must use the LAN instead of the mesh | ||
3183 | */ | ||
3184 | if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig)) | ||
3185 | goto out; | ||
3186 | |||
3187 | if (!batadv_tt_global_add(bat_priv, orig_node, addr, vid, | 3173 | if (!batadv_tt_global_add(bat_priv, orig_node, addr, vid, |
3188 | BATADV_TT_CLIENT_TEMP, | 3174 | BATADV_TT_CLIENT_TEMP, |
3189 | atomic_read(&orig_node->last_ttvn))) | 3175 | atomic_read(&orig_node->last_ttvn))) |
@@ -3344,13 +3330,6 @@ static int batadv_roam_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv, | |||
3344 | if (!batadv_is_my_mac(bat_priv, dst)) | 3330 | if (!batadv_is_my_mac(bat_priv, dst)) |
3345 | return NET_RX_DROP; | 3331 | return NET_RX_DROP; |
3346 | 3332 | ||
3347 | /* check if it is a backbone gateway. we don't accept | ||
3348 | * roaming advertisement from it, as it has the same | ||
3349 | * entries as we have. | ||
3350 | */ | ||
3351 | if (batadv_bla_is_backbone_gw_orig(bat_priv, src)) | ||
3352 | goto out; | ||
3353 | |||
3354 | if (tvlv_value_len < sizeof(*roaming_adv)) | 3333 | if (tvlv_value_len < sizeof(*roaming_adv)) |
3355 | goto out; | 3334 | goto out; |
3356 | 3335 | ||