Bug #221
closed
Collision into tt hash tables
Added by Def D over 9 years ago.
Updated almost 8 years ago.
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);
}
Please send patches to the mailing list. Here a few guidelines: Contribute
Thanks!
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.
Do you want I send my little patch to the mailing list ?
With the title "Fix batadv_compare_tt function"
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!
- Status changed from New to Closed
Fixed with release v2015.2
- Target version set to 2015.2
Also available in: Atom
PDF