Add packet capture for multiplayer traffic #2146
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds support for logging network traffic in tcpdump (
.pcap
) format. You can enable this inConfig -> Emu -> Devtools
.This seems to work fine when capturing traffic between two multiplayer instances, verified by booting two instances to firmware, opening Pictochat and comparing the logs to promiscuous mode captures of real hardware doing the same.
However, when a game connects to the internet, you'll currently get a partial log - the
Platform::MP_Send*
hooks are called for outgoing packets, but thePlatform::MP_Recv*
ones aren't called for the incoming ones. ThePlatform::Net_Recv*
hooks are called for them, but they're just passed the source/destination IP, packet type and contents, not the full WiFi frame, which isn't enough to log them.I don't understand the WiFi emulation code nearly well enough to figure out quite what the right behaviour or thing to do here is, so hopefully somebody who does could help me out here.
You can reproduce this very easily by enabling packet capture, booting up any game with WFC support and tapping Nintendo WFC Settings -> Nintendo WiFi Connection Settings -> Connection 1 -> Test Connection. If you open the pcap file in Wireshark, you'll see an outgoing DNS query for
conntest.nintendowifi.net
, followed by a HTTP GET request, but the responses are missing.Anyway, this is what
Config -> Emu -> Devtools
looks like now:(The
.pcap
files for secondary multiplayer instances are namedmyrom.2.pcap
, rather thanmyrom.pcap.2
as is the case for other files, simply so that they show up in eg. Wireshark's file picker and have the right extension when opened by an external program. I can change this for consistency if wanted.)