Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEV9: Adapter Utils Cleanup #11271

Merged
merged 8 commits into from
May 30, 2024

Conversation

TheLastRar
Copy link
Contributor

Description of Changes

Merge code related to getting a network adapter.
Corrected the buffer type used for GetAdaptersAddresses(), as other structures where also placed in there.
Replace C-Style casts with C++ equivalents.

It may be easier to review each commit one by one rather than the whole pr at once

Rationale behind Changes

This effort was mostly born this #10937 (comment), regarding type punning
The socket api does not make it easy to avoid UB type punning, due to strict aliasing rules, The general consensus appears to be that these types are passed in an aliased form and we just cast back to get the true type.

Suggested Testing Steps

Test connection with pcap. sockets and tap
Test the above (where supported) on Windows, Linux and FreeBSD/Mac

@github-actions github-actions bot added the DEV9 label May 19, 2024
@TheLastRar TheLastRar force-pushed the DEV9-AdapterUtilsCleanup branch 2 times, most recently from dbdde84 to 1f7406b Compare May 22, 2024 20:11
@TheLastRar TheLastRar marked this pull request as draft May 23, 2024 09:30
Returned data is not sequenced IP_ADAPTER_ADDRESSES entries
We will use implicit object creation avoid UB
This attempts to avoid undefined behaviour with our current assumptions about the socket api
Giving same flow as Windows code
@TheLastRar TheLastRar force-pushed the DEV9-AdapterUtilsCleanup branch 2 times, most recently from 9ac24c1 to bf60855 Compare May 23, 2024 12:39
@TheLastRar TheLastRar marked this pull request as ready for review May 23, 2024 21:01
@AmyRoxwell
Copy link

Tested for Sockets on Appimage for linux, seems to work fine!

Screenshot_05_24_2024-10

Emulog for reference:
emulog.zip

@refractionpcsx2 refractionpcsx2 merged commit ee9866b into PCSX2:master May 30, 2024
12 checks passed
@TheLastRar TheLastRar deleted the DEV9-AdapterUtilsCleanup branch May 30, 2024 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants