Wireshark-dev: Re: [Wireshark-dev] Registering Dissector for Private SNAP PID
From: Guy Harris <[email protected]>
Date: Thu, 4 Apr 2013 01:23:03 -0700
On Apr 3, 2013, at 7:42 AM, Christopher Merck <[email protected]> wrote:

> I almost have this working. But what I don't understand is the fourth argument to llc_add_oui. That structure contains a list of PIDs to register and the table name. However, when I am registering the OUI I don't want to register any PIDs yet, and I have already specified the table_name as the second argument to llc_add_oui.
> 
> So, I'm trying to stuff some dummy data into hf_pid, but I get segfaults or assertion errors at runtime.
> 
> Any idea what I'm missing?

You're missing the idea that the "pid" field is not a generic field shared by all OUIs; a separate field should be created for each OUI, with, for example ProtoField.new:

	http://www.wireshark.org/docs/wsug_html_chunked/lua_module_Proto.html#lua_class_ProtoField

You might have to look at the wslua code to see how to get the hf_register_info for a ProtoField passed as an argument to a Lua function written in C.

Whether that's causing the crashes is another matter, but I don't see any code actually *registering* the hf_pid field in your sample code, which is definitely a problem - if the (Lua) caller of your llc_add_oui() Lua function calls ProtoField.new, that will register the field, so that problem won't exist any more.