Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] how to add global per-capture state?

From: Aurélien Aptel <aaptel@xxxxxxxx>
Date: Mon, 24 Feb 2020 15:08:10 +0100
Hi,

I'm working on the SMB2 dissector (packet-smb2.c) and I'd like to have
better support for multichannel where an authenticated session is shared
across TCP sessions.

So at the moment, we store a hashtable in the conversation. That table
maps SessionId => Session Data

When a new channel is opened for that session it will share the same ID
but since it's a different TCP connection, it will be in a different
conversation so we won't be able to lookup the existing Session Data.

The solution would be to make the SessionID=>SessionData hashtable
global per-capture instead of per-conversation.

How is this usually done in a Wireshark dissector?

I was thinking of having a global static hashtable in the dissector but
then I would need to reset it when the capture is opened/closed...

Cheers,
-- 
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)