Skip to content

Wireshark Wlua does not dissect flags #815

@hamishwillee

Description

@hamishwillee

An error is shown if you try to inspect a message, such as HEARTBEAT, that has flags, and you can't inspect any fields after that flag. For example in HEARTBEAT this is the mode flag:

There are two issues. Firstly, the value returned by tree:add_le is nil, so what gets passed into dissect_flags_MAV_MODE_FLAG cannot be dissected. The docs say tree:add_le should return a value. My assumption is that this is failing for the reason given after the code. Note that this is the only place the value is actually used, which is why we don't see the error elsewhere.

    field_offset = offset + 6
    subtree, value = tree:add_le(f.HEARTBEAT_base_mode, padded(field_offset, 1))
    dissect_flags_MAV_MODE_FLAG(subtree, "HEARTBEAT_base_mode", value)

I "fixed" this error by passing in padded(field_offset, 1) to dissect_flags_MAV_MODE_FLAG instead of value. Wireshark now fails with the error that the data passed in is "userData" - i.e. an arbitrary C data that it can't interpret. That's correct, and probably why nil got returned from the tree:add_le.

The solution would be to cast the data to a number before passing it to tree:add_le. HOwever I don't know how to do this elegantly.

This is cross posted (and summarised) from mavlink/mavlink#1978

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions