Skip to content

Commit

Permalink
batman-adv: detect local excess vlans in TT request
Browse files Browse the repository at this point in the history
If the local representation of the global TT table of one originator has
more VLAN entries than the respective TT update, there is some
inconsistency present. By detecting and reporting this inconsistency,
the global table gets updated and the excess VLAN will get removed in
the process.

Reported-by: Alessandro Bolletta <alessandro@mediaspot.net>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Acked-by: Antonio Quartulli <antonio@meshcoding.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
  • Loading branch information
Simon Wunderlich authored and Antonio Quartulli committed Dec 16, 2015
1 parent 18165f6 commit c169c59
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion net/batman-adv/translation-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -2411,8 +2411,8 @@ static bool batadv_tt_global_check_crc(struct batadv_orig_node *orig_node,
{
struct batadv_tvlv_tt_vlan_data *tt_vlan_tmp;
struct batadv_orig_node_vlan *vlan;
int i, orig_num_vlan;
u32 crc;
int i;

/* check if each received CRC matches the locally stored one */
for (i = 0; i < num_vlan; i++) {
Expand All @@ -2438,6 +2438,18 @@ static bool batadv_tt_global_check_crc(struct batadv_orig_node *orig_node,
return false;
}

/* check if any excess VLANs exist locally for the originator
* which are not mentioned in the TVLV from the originator.
*/
rcu_read_lock();
orig_num_vlan = 0;
hlist_for_each_entry_rcu(vlan, &orig_node->vlan_list, list)
orig_num_vlan++;
rcu_read_unlock();

if (orig_num_vlan > num_vlan)
return false;

return true;
}

Expand Down

0 comments on commit c169c59

Please sign in to comment.