Project

General

Profile

Bug #221

Collision into tt hash tables

Added by Def D about 4 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
Start date:
07/24/2015
Due date:
% Done:

0%

Estimated time:

Description

Using maint branch

There is a collision in my batman network that counting 5 vlans.
A mac addr is not added into tt hash tables because the function batadv_compare_tt does not check vid of mac addr.
If a mac exist into several vlans (generaly true) , and the function batadv_choose_tt return the same hash for two couples of mac:vid, then only one is registred.

This patch work for me

static int batadv_compare_tt(const struct hlist_node *node, const void *data2)
{
        const void *data1 = container_of(node, struct batadv_tt_common_entry,
                                         hash_entry);

-       return batadv_compare_eth(data1, data2);
+       struct batadv_tt_common_entry* tt1 = data1;
+       struct batadv_tt_common_entry* tt2 = data2;
+
+       return (tt1->vid == tt2->vid) && batadv_compare_eth(data1, data2);
 }

History

#1

Updated by Marek Lindner about 4 years ago

Please send patches to the mailing list. Here a few guidelines: Contribute

Thanks!

#2

Updated by Antonio Quartulli about 4 years ago

Actually this does not lead to a "hash collision" (which would only have effects on the performance and therefore would have not been a real bug since hash tables are implemented in a way that takes care of collisions), because the hash function is computed in "batadv_choose_tt()" .

"batadv_compare_tt()" is the routine deciding whether the object found through the hash function is really the one we are looking for or not. Therefore this means that you can have issues only in cases when "batadv_choose_tt()" should compute the same hash value for two entries having the same MAC but different VID (this is not impossible but rather unlikely).

This said, the bug report is valid and the fix too (thanks!! :)) but I wanted to clarify on the severity of this bug.

#3

Updated by Def D about 4 years ago

Do you want I send my little patch to the mailing list ?
With the title "Fix batadv_compare_tt function"

#4

Updated by Marek Lindner about 4 years ago

Def D wrote:

Do you want I send my little patch to the mailing list ?
With the title "Fix batadv_compare_tt function"

Please always send patches to the mailing list. That is were we discuss code submissions.

Thanks!

#5

Updated by Simon Wunderlich over 3 years ago

  • Status changed from New to Closed

Fixed with release v2015.2

#6

Updated by Sven Eckelmann over 2 years ago

  • Target version set to 2015.2

Also available in: Atom PDF