Project

General

Profile

Actions

Bug #221

closed

Collision into tt hash tables

Added by Def D over 8 years ago. Updated about 7 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);
 }

Actions #1

Updated by Marek Lindner over 8 years ago

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

Thanks!

Actions #2

Updated by Antonio Quartulli over 8 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.

Actions #3

Updated by Def D over 8 years ago

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

Actions #4

Updated by Marek Lindner over 8 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!

Actions #5

Updated by Simon Wunderlich about 8 years ago

  • Status changed from New to Closed

Fixed with release v2015.2

Actions #6

Updated by Sven Eckelmann about 7 years ago

  • Target version set to 2015.2
Actions

Also available in: Atom PDF