Hi,
I'm using calltable caching from trunk, and found that it segfaults. I've done some exploration (I'm not proficient in C++, but am in C and other languages), and have found that the issue is references in the calltable cache to calltable_element instances in the "table" vector. It turns out that C++ vectors can re-arrange themselves internally, which makes sense, so you cannot refer to the memory address of an element directly - you should refer to an index in to the vector.
The call_id_cache seems to do this, but the "cache" does not.
This reliably causes segfaults for me on Linux (Centos 7...something) but not on MacOS with the same input sample.
I've fixed this by making the addr/port indexed cache (aka "cache") use an integer index (idx) in to the calltable vector rather than a pointer to the calltable element.
This means that add_ip_port needs to do additional work to find the index to the calltable_element, whereas previously it would be only setting ce, but, that's fine.
I have additionally tweaked some performance where "table[i_leg]" was being called many many times when trying to resolve cache misses, so instead look it up once, and then refer to it. This may not actually be useful, as I had a bug further up which was generating a lot of cache misses.. but it will probably make things faster for users not using the calltable cache, anyway.
I am not a C++ developer, and have only used it a handful of times, but I am proficient in C and other languages. I've attempted to mimic the style etc. of the original work. Certainly, stackexchange has helped, and I've learned a lot working on this today. I hope I have not butchered it too much !
Useful data - I am able to capture around 40mbit (each way) of voice traffic with this, on about 30% of a single thread of a Xeon D-1518 with this code. With calltable cache disabled, it gets to about 100% and starts dropping packets in about 15 seconds.
Patch attached, and relies on my previous two patches.
Code is in a github version here: https://github.com/nward/pcapsipdump/tree/calltable_cache_fixes