Skip to content

Fix Wireshark dissector and add snapshot tests#817

Merged
peterbarker merged 1 commit intoArduPilot:masterfrom
rotu:lua-bitflags
Sep 5, 2023
Merged

Fix Wireshark dissector and add snapshot tests#817
peterbarker merged 1 commit intoArduPilot:masterfrom
rotu:lua-bitflags

Conversation

@rotu
Copy link
Contributor

@rotu rotu commented May 15, 2023

Handle bit flags in Wireshark dissector (fix #815, fix #726)
Add tests for Wireshark (via tshark binary and pytest via the syrupy snapshot library)
Remove defunct mav2pcap.py script

@hamishwillee
Copy link
Contributor

@rotu Tried this out. Certainly fixes the error we were seeing. I particularly like how clear the bitflags are rendered:

image

I also looked at many other message, including commands, and nothing seems broken:

image

Excellent to see test code of this. Would be good to expand it in future as a validation test. Out of scope for this probably.

The generator code changes make sense to me, and I think this also makes the generated code much more clear.

However I am not expert. Once you have this to a state you are happy with, we'll need to work with @peterbarker to get this in.

@rotu
Copy link
Contributor Author

rotu commented May 18, 2023

I'm not an expert either. Thanks for the screenshots! I think they highlight some other bugs!

The second message you show is a COMMAND_INT, where param2 is a float.

The value shown is 1065353216 which I think is supposed to be the floating point value 1.0f, corresponding to 1; i.e. MAV_DO_REPOSITION_FLAGS_CHANGE_MODE: True.

Also the longitude/latitude values are payload parameters 5/6 so I think they should be int32_t, not float, hence the wonky-looking values.

Could you please attach some pcap data I can test against?

@hamishwillee
Copy link
Contributor

hamishwillee commented May 23, 2023

Looks like you're right. I ran this for a few seconds and then did a save-as. Is this what you needed?

pcapdata.zip

PS, more of an expert than me.

@hamishwillee
Copy link
Contributor

PS Also a CI error

@rotu
Copy link
Contributor Author

rotu commented May 24, 2023

I see the CI errors and but the alternative is to use the obsolete pkg_resources and I hate writing new legacy code. When are we dropping python 2.7 and 3.6 support per #556?

@hamishwillee
Copy link
Contributor

@rotu Could not agree more.
PX4 have dropped support for Python 2, and I understand that ArduPilot either have done so, or will be doing so very shortly. If those dependencies are gone, we should be able to switch over "very soon". I'll push for that, so ignore the error for now.
Wr.t. dropping Python 3.6 that is harder - we are in discussion.

As I understand it you're looking at the other issues with the generated output. Since I'm very happy for you to do so I'm going to just keep quiet now :-)

@hamishwillee
Copy link
Contributor

@rotu This isn't waiting on me for anything is it?

@rotu rotu force-pushed the lua-bitflags branch 2 times, most recently from d4efcaf to 69edcd2 Compare June 9, 2023 20:23
@hamishwillee
Copy link
Contributor

Hi @rotu
Looks like you are still progressing. Let me know when you need more review.

@rotu
Copy link
Contributor Author

rotu commented Jun 23, 2023

@hamishwillee Yep. I'm chipping away slowly. I'm a little hung up on getting the output to match when there are long lines (not sure how to get the output of tshark to wrap to a consistent line length)

@rotu rotu changed the title Wireshark Dissector Fixes Fix Wireshark dissector and add snapshot tests Jun 24, 2023
@rotu rotu marked this pull request as ready for review June 24, 2023 21:15
@rotu
Copy link
Contributor Author

rotu commented Jul 4, 2023

Alright I'm sufficiently sick of this PR, so it's time to get it out there!

@hamishwillee
Copy link
Contributor

@rotu I can imagine. Time for me to get a technical review on this?

@rotu
Copy link
Contributor Author

rotu commented Jul 5, 2023

@rotu I can imagine. Time for me to get a technical review on this?

I don't understand what you mean. Do whatever you need, loop in whoever you like, and ask whatever questions to satisfy your curiosity.

@hamishwillee
Copy link
Contributor

@peterbarker Can you review this please. I think it is important to get in.

I have done basic tests on it by running the instructions in https://mavlink.io/en/guide/wireshark.html and also specifically looking at the HEARTBEAT message to check that the known issue was fixed.
This definitely fixes the original problem in a logic way, and the resulting output is also good.

@rotu Has also added a heap of test code. I have not tested that, since I have no merge rights, and you will have to do this anyway.

Copy link
Contributor

@peterbarker peterbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rotu could you fix the commit list, please? Should be a single commit

@peterbarker
Copy link
Contributor

... should have said I'm happy enough to merge this with a good commit list.

@rotu
Copy link
Contributor Author

rotu commented Aug 30, 2023

... should have said I'm happy enough to merge this with a good commit list.

@peterbarker
Feel free to squash merge. https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/configuring-commit-squashing-for-pull-requests

add tests, remove defunct script
@peterbarker peterbarker merged commit b1e16d1 into ArduPilot:master Sep 5, 2023
@peterbarker
Copy link
Contributor

Merged, thanks!

@hamishwillee
Copy link
Contributor

Hurray. Thanks!

@rotu rotu deleted the lua-bitflags branch September 23, 2023 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wireshark Wlua does not dissect flags Wireshark dissect bit fields fails

3 participants