Mailing List Archive

fix empty arpcache bug
--==========2873937794==========
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

hi all,

i've found a little problem in the arpcache code segment: if you happen to
have an empty local arpcache and you try to start wackamole you won't
succeed, because the sample_arp_cache() function is returning an NULL
pointer in that very case.

please find attached a patch which is fixing the problem mentioned above.
the patch is against wackamole-2.0.0.

btw: thanks for that great piece of software!

cheers,
-- matt.
--==========2873937794==========
Content-Type: text/plain; charset=us-ascii;
name="fix-empty-arpcache.patch.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="fix-empty-arpcache.patch.txt";
size=545

--- arpcache.c 2002-09-22 20:43:34.000000000 +0200
+++ arpcache.c.new 2003-10-02 13:38:01.000000000 +0200
@@ -90,9 +90,12 @@
}
}

- if( count == 0 && arpcache_psize > 0 ){
- arpcache_psize = 0;
+ if( count == 0 ){
+ Alarm(DEBUG, "Local arp-cache seems to be empty");
if(arpcache_private) free(arpcache_private);
+ arpcache_psize = 0;
+ arpcache_private = malloc(sizeof(address));
+ arpcache_private[0] = 0;
} else {
/* adjust array size (FIXME: should we really do this?) */
if( count != tmp_size ){

--==========2873937794==========--
fix empty arpcache bug [ In reply to ]
On Thursday, Oct 2, 2003, at 11:41 US/Eastern, Matthias Weidle wrote:
> i've found a little problem in the arpcache code segment: if you
> happen to have an empty local arpcache and you try to start wackamole
> you won't succeed, because the sample_arp_cache() function is
> returning an NULL pointer in that very case.
>
> please find attached a patch which is fixing the problem mentioned
> above. the patch is against wackamole-2.0.0.
>
> btw: thanks for that great piece of software!

This has been applied to head.

// Theo Schlossnagle
// Principal Engineer -- http://www.omniti.com/~jesus/
// Postal Engine -- http://www.postalengine.com/
// Ecelerity: fastest MTA on earth