Chasing bugs

I've been chasing several bugs all day today:

  • scanner came up with invalid RTP header length on one-off packet in a huge capture. Turned out the RTP extension header address was incorrectly calculated in validate_rtp().
  • JMemoryPacket incorrectly set wire_length of the packet this also caused header lengths to be miscalculated
  • Ip4 payload calculation was incorrectly set for ip fragments. This also caused problems with a sanity check that scanner performs making sure that header lengths never exceed wire_len. This check was failing for ICMP encapsualated IP4 header which don't have their tot_len adjusted.

Also added a small native debugging and tracing library. It allows the main decoder loop to be traced in detail for debugging purposes as well as a number of protocols. I plan on making this a java software switchable to enable/disable low level tracing output. All trace statements are enclosed in ifdef(DEBUG) preprocessor conditionals, therefore all the debugging and tracing code will not be compiled into production versions of library. But I will be releasing dev builds with full DEBUG compiled in and controllable through a verbosity level just like with java loggers.

I've been working on automated debugging and tracing in case something goes wrong. Packet decoder exceptions will be able to gather lots of debug information to be sent back to developers, including complete trace output of the scanners, dissectors and analyzers. I'm automating it so that on exception, the thrown object will generate a working java jUnit testcase with the packet that threw the exception. The testcase will contain the packet data, all the traces and all available debug string, as well as library and platform info to be reported back.