* [B.A.T.M.A.N.] [vis] Remove duplicate routes from vis output
@ 2009-07-15 13:59 Edwe Cowley
2009-07-15 17:21 ` Marek Lindner
2009-07-15 17:37 ` [B.A.T.M.A.N.] [vis] Remove duplicate routes from vis output (revised) Marek Lindner
0 siblings, 2 replies; 5+ messages in thread
From: Edwe Cowley @ 2009-07-15 13:59 UTC (permalink / raw)
To: b.a.t.m.a.n
Revision 1271 introduced a bug on the call to hash->compare() that
caused duplicate routes to appear in the output. Inverted the
conditional and now it works.
Signed-off-by: Edwe Cowley <edwecowley@gmail.com>
Index: batman/hash.c
===================================================================
--- batman/hash.c (revision 1343)
+++ batman/hash.c (working copy)
@@ -179,7 +179,7 @@
bucket = hash->table[index];
while (bucket != NULL) {
- if (hash->compare(bucket->data, data))
+ if (!(hash->compare(bucket->data, data)))
return -1;
prev_bucket = bucket;
@@ -217,7 +217,7 @@
bucket = hash->table[index];
while (bucket != NULL) {
- if (hash->compare(bucket->data, keydata))
+ if (!(hash->compare(bucket->data, keydata)))
return bucket->data;
bucket = bucket->next;
@@ -260,7 +260,7 @@
hash_it_t.prev_bucket = NULL;
while (hash_it_t.bucket != NULL) {
- if (hash->compare(hash_it_t.bucket->data, data)) {
+ if (!(hash->compare(hash_it_t.bucket->data, data))) {
hash_it_t.first_bucket = (hash_it_t.bucket ==
hash->table[hash_it_t.index] ? &hash->table[ hash_it_t.index ] :
NULL);
return hash_remove_bucket(hash, &hash_it_t);
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [B.A.T.M.A.N.] [vis] Remove duplicate routes from vis output
2009-07-15 13:59 [B.A.T.M.A.N.] [vis] Remove duplicate routes from vis output Edwe Cowley
@ 2009-07-15 17:21 ` Marek Lindner
2009-07-16 6:57 ` Edwe Cowley
2009-07-15 17:37 ` [B.A.T.M.A.N.] [vis] Remove duplicate routes from vis output (revised) Marek Lindner
1 sibling, 1 reply; 5+ messages in thread
From: Marek Lindner @ 2009-07-15 17:21 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
On Wednesday 15 July 2009 21:59:32 Edwe Cowley wrote:
> Revision 1271 introduced a bug on the call to hash->compare() that
> caused duplicate routes to appear in the output. Inverted the
> conditional and now it works.
Thanks for informing us about this bug and proposing a solution. This is a bit
tricky since batman and the vis server share the same hash implementation
code. If we apply your patch we will move the bugs to batman. As you correctly
pointed out the bug was introduced with 1271 because the vis hash->compare()
callback function was not adapted. Please consider my following patch and let
me know if it works for you.
Regards,
Marek
^ permalink raw reply [flat|nested] 5+ messages in thread
* [B.A.T.M.A.N.] [vis] Remove duplicate routes from vis output (revised)
2009-07-15 13:59 [B.A.T.M.A.N.] [vis] Remove duplicate routes from vis output Edwe Cowley
2009-07-15 17:21 ` Marek Lindner
@ 2009-07-15 17:37 ` Marek Lindner
1 sibling, 0 replies; 5+ messages in thread
From: Marek Lindner @ 2009-07-15 17:37 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
Revision 1271 introduced a bug on the call to hash->compare() that
caused duplicate routes to appear in the vis output. Adapting the
hash->compare() callback fixes the problem.
Signed-off-by: Edwe Cowley <edwecowley@gmail.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Index: vis/vis.c
===================================================================
--- vis/vis.c (revision 1343)
+++ vis/vis.c (working copy)
@@ -119,8 +119,9 @@
return stop != 0;
}
-int32_t orig_comp(void *data1, void *data2) {
- return(memcmp(data1, data2, 4));
+int32_t orig_comp(void *data1, void *data2)
+{
+ return (memcmp(data1, data2, 4) == 0 ? 1 : 0);
}
/* hashfunction to choose an entry in a hash table of given size */
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [B.A.T.M.A.N.] [vis] Remove duplicate routes from vis output
2009-07-15 17:21 ` Marek Lindner
@ 2009-07-16 6:57 ` Edwe Cowley
2009-07-16 10:42 ` Marek Lindner
0 siblings, 1 reply; 5+ messages in thread
From: Edwe Cowley @ 2009-07-16 6:57 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
The vis server seems to work perfectly after applying your proposed
patch. Thank you.
Regards
Edwe
On Wed, Jul 15, 2009 at 7:21 PM, Marek Lindner<lindner_marek@yahoo.de> wrote:
> On Wednesday 15 July 2009 21:59:32 Edwe Cowley wrote:
>> Revision 1271 introduced a bug on the call to hash->compare() that
>> caused duplicate routes to appear in the output. Inverted the
>> conditional and now it works.
>
> Thanks for informing us about this bug and proposing a solution. This is a bit
> tricky since batman and the vis server share the same hash implementation
> code. If we apply your patch we will move the bugs to batman. As you correctly
> pointed out the bug was introduced with 1271 because the vis hash->compare()
> callback function was not adapted. Please consider my following patch and let
> me know if it works for you.
>
> Regards,
> Marek
>
> _______________________________________________
> B.A.T.M.A.N mailing list
> B.A.T.M.A.N@lists.open-mesh.net
> https://lists.open-mesh.net/mm/listinfo/b.a.t.m.a.n
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [B.A.T.M.A.N.] [vis] Remove duplicate routes from vis output
2009-07-16 6:57 ` Edwe Cowley
@ 2009-07-16 10:42 ` Marek Lindner
0 siblings, 0 replies; 5+ messages in thread
From: Marek Lindner @ 2009-07-16 10:42 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
On Thursday 16 July 2009 14:57:28 Edwe Cowley wrote:
> The vis server seems to work perfectly after applying your proposed
> patch. Thank you.
Ok, it is in the repos now.
Regards,
Marek
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-07-16 10:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-15 13:59 [B.A.T.M.A.N.] [vis] Remove duplicate routes from vis output Edwe Cowley
2009-07-15 17:21 ` Marek Lindner
2009-07-16 6:57 ` Edwe Cowley
2009-07-16 10:42 ` Marek Lindner
2009-07-15 17:37 ` [B.A.T.M.A.N.] [vis] Remove duplicate routes from vis output (revised) Marek Lindner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox