1 | initial version |
The VLAN Display Filter Reference page lists several VLAN-related fields. You can access any of them from your Lua dissector with something like so:
-- Ref: https://www.wireshark.org/docs/wsdg_html/#wsluarm_modules
local foo = Proto("FOO", "Foo")
local foo_vlan_id = ProtoField.uint16("foo.vlan_id", "VLAN ID")
-- Section 11.2.1.1: Use Field extractor to grab field of interest
local vlan_id = Field.new("vlan.id")
function foo.dissector(tvbuf, pinfo, tree)
local foo_tree = tree: add(foo, "Foo")
foo_tree:add(foo_vlan_id, vlan_id().value)
end
2 | No.2 Revision |
The VLAN Display Filter Reference page lists several VLAN-related fields. You can access any of them from your Lua dissector with something like so:
-- Ref: https://www.wireshark.org/docs/wsdg_html/#wsluarm_modules
local foo = Proto("FOO", "Foo")
local foo_vlan_id = ProtoField.uint16("foo.vlan_id", "VLAN ID")
-- Section 11.2.1.1: Use Field extractor to grab field of interest
local vlan_id = Field.new("vlan.id")
function foo.dissector(tvbuf, pinfo, tree)
local foo_tree = tree: add(foo, tree:add(foo, "Foo")
foo_tree:add(foo_vlan_id, vlan_id().value)
end