aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Sockets
AgeCommit message (Collapse)Author
2023-04-27Move solution and projects to srcTSR Berry
2023-04-14Rename Hipc to Cmif where appropriate (#3880)Alex Barney
2023-02-28Sockets: Properly convert error codes on MacOS (#4491)riperiperi
* Sockets: Properly convert error codes on MacOS The error codes for MacOS are very different to how they are on windows or linux. An alternate mapping is used when the host operating system is MacOS. This PR also defaults IsDhcpEnabled to true when interfaceProperties.DhcpServerAddresses is not available. This change was already in `macos1`. * Address feedback
2023-01-18Optimize string memory usage. Use Spans and StringBuilders where possible ↵Andrey Sukharev
(#3933) * Optimize string memory usage. Use ReadOnlySpan<char> and StringBuilder where possible. * Fix copypaste error * Code generator review fixes * Use if statement instead of switch * Code style fixes Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Another code style fix * Styling fix Co-authored-by: Mary-nyan <thog@protonmail.com> * Styling fix Co-authored-by: gdkchan <gab.dark.100@gmail.com> Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Co-authored-by: Mary-nyan <thog@protonmail.com> Co-authored-by: gdkchan <gab.dark.100@gmail.com>
2022-12-26bsd::RecvFrom: verify output buffer size before writing socket address (#4135)gnisman
* bsd::RecvFrom: Ryujinx does not verify output buffer size before writing socket address * Calculate the size of BsdSockAddr * use bsdSockAddr variable * Update Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs Co-authored-by: Mary-nyan <thog@protonmail.com> * Update Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdSockAddr.cs Co-authored-by: Mary-nyan <thog@protonmail.com> * set errno to ENOMEM in case we can't write the address to memory * Update Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs Co-authored-by: Ac_K <Acoustik666@gmail.com> * Update Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs Co-authored-by: Mary-nyan <thog@protonmail.com> Co-authored-by: Ac_K <Acoustik666@gmail.com>
2022-12-12Bsd: Add support for dns_mitm (#4102)TSRBerry
* bsd: Add dns_mitm from Atmosphère related AMS files: - https://github.com/Atmosphere-NX/Atmosphere/blob/master/stratosphere/ams_mitm/source/dns_mitm/dnsmitm_resolver_impl.cpp - https://github.com/Atmosphere-NX/Atmosphere/blob/master/stratosphere/ams_mitm/source/dns_mitm/dnsmitm_host_redirection.cpp * Remove debug logging and adjust redirect message * Improve formatting Co-authored-by: Ac_K <Acoustik666@gmail.com> * Replace Initialize with instance property * bsd: dns_mitm - Ignore empty lines * bsd: Mark _mitmHostEntries as readonly * bsd: Initialize Aliases when returning IpHostEntry Fixes NullReferenceException Co-authored-by: Ac_K <Acoustik666@gmail.com>
2022-12-12Bsd: Implement Select (#4017)TSRBerry
* bsd: Add gdkchan's Select implementation Co-authored-by: TSRBerry <20988865+tsrberry@users.noreply.github.com> * bsd: Fix Select() causing a crash with an ArgumentException .NET Sockets have to be used for the Select() call * bsd: Make Select more generic * bsd: Adjust namespaces and remove unused imports * bsd: Fix NullReferenceException in Select Co-authored-by: gdkchan <gab.dark.100@gmail.com>
2022-12-04Use source generated regular expressions (#4005)Andrey Sukharev
2022-11-28sfdnsres; Fix deserializer of AddrInfoSerialized when addresses are empty ↵Ac_K
(#3924)
2022-11-27bsd: Fix eventfd broken logic (#3647)Mary-nyan
* bsd: Fix eventfd broken logic This commit fix eventfd logic being broken. The following changes were made: - EventFd IPC definition had argument inverted - EventFd events weren't fired correctly - Poll logic was wrong and unfinished for eventfd - Reintroduce workaround from #3385 but in a safer way, and spawn 4 threads. * ipc: Rework a bit for multithreads * Clean up debug logs * Make server thread yield when managed lock isn't availaible * Fix replyTargetHandle not being added in the proper locking scope * Simplify some scopes * Address gdkchan's comments * Revert IPC workaround for now * Reintroduce the EventFileDescriptor workaround
2022-10-15bsd: Check if socket is bound before calling RecvFrom() (#3761)TSRBerry
2022-09-07bsd: improve socket pollMary
We should report errors even when not requested. This also ensure we only clear the bits that were requested on the output. Finally, this fix when input events is 0.
2022-09-07bsd: implement SendMMsg and RecvMMsg (#3660)Mary-nyan
* bsd: implement sendmmsg and recvmmsg * Fix wrong increment of vlen
2022-09-01Bsd: Fix NullReferenceException in BsdSockAddr.FromIPEndPoint() (#3652)TSRBerry
* Bsd: Fix NullReferenceException in BsdSockAddr.FromIPEndPoint() Allows "Victor Vran Overkill Edition" to boot with guest internet access enabled. Thanks to EmulationFanatic for testing this for me! * Bsd: Return proper error code if RemoteEndPoint is null * Remove whitespace from empty line Co-authored-by: gdkchan <gab.dark.100@gmail.com> Co-authored-by: gdkchan <gab.dark.100@gmail.com>
2022-09-01bsd: Fix Poll(0) returning ETIMEDOUT instead of SUCCESSMary
This was an oversight of the implementation.
2022-09-01sfdsnres: fix endianess issue for port serialisationMary
2022-08-28Bsd: Fix ArgumentOutOfRangeException in SetSocketOption (#3633)TSRBerry
* Bsd: Fix ArgumentOutOfRangeException in SetSocketOption * Ensure option level is Socket before checking for SoLinger
2022-08-26bsd: Fix Poll writting in input buffer (#3630)Mary-nyan
This is a very old oversight on our Poll implementation. This worked so far reliably because games and homebrews pass the same buffer as input and output.
2022-08-18Removed unused usings. (#3593)Nicholas Rodine
* Removed unused usings. * Added back using, now that it's used. * Removed extra whitespace.
2022-08-11Rename ToSpan to AsSpan (#3556)gdkchan
2022-08-03Sfdnsres; Stub ResolverSetOptionRequest (#3493)Ac_K
This PR stub ResolverSetOptionRequest (checked by RE), but the options parsing is still missing since we don't support it in our current code. (Close #3479)
2022-07-14BSD: Allow use of DontWait flag in Receive (#3462)Fruityloops
2022-07-12Handle the case where byte optionValues are sent to BSD (#3405)riperiperi
Some games and the Mario Odyssey Multiplayer mod do this. The SMO multiplayer mod also needs you to revert #3394 as it uses a blocking socket to receive (otherwise it hangs), and it doesn't seem to like being forced as non-blocking.
2022-06-12Less invasive fix for EventFd blocking operations (#3394)gdkchan
2022-06-11Allow concurrent BSD EventFd read/write (#3385)gdkchan
2022-02-09misc: Make PID unsigned long instead of long (#3043)Mary
2022-01-12bsd: Revamp API and make socket abstract (#2960)Mary
* bsd: Revamp API and make socket abstract This part of the code was really ancient and needed some love. As such this commit aims at separating the socket core logic from the IClient class and make it uses more modern APIs to read/write/parse data. * Address gdkchan's comment * Move TryConvertSocketOption to WinSockHelper * Allow reusing old fds and add missing locks around SocketInternal and ShutdownAllSockets * bsd: ton of changes - Make sockets per process - Implement eventfds - Rework Poll for support of eventfds - Handle protocol auto selection by type (used by gRPC) - Handle IPv6 socket creation * Address most of gdkchan comments * Fix inverted read logic for BSD socket read * bsd: Make Poll abstract via IBsdSocketPollManager * bsd: Improve naming of everything * Fix build issue from last commit (missed to save on VC) * Switch BsdContext registry to a concurrent dictionary * bsd: Implement socket creation flags logic and the non blocking flag * Remove unused enum from previous commit * bsd: Fix poll logic when 0 fds are present for a given poll manager and when timeout is very small (or 0) * Address gdkchan's comment
2022-01-12sfdnsres: Fix serialization issues (#2992)Mary
* sfdnsres: Fix serialization issues Fix a crash on Monster Hunter Rise * Address gdkchan's comments * Address gdkchan's comments
2022-01-11sfdnsres: Block communication attempt with NPLN servers (#2990)Mary
Seen on Monster Hunter Rise.
2022-01-08Return error on DNS resolution when guest internet access is disabled (#2983)gdkchan
* Return error on DNS resolution when guest internet access is disabled * Log DNS lookup calls
2022-01-03sfdnsres: Implement NSD resolution (#2962)Mary
This fix a missing implementation usage of NSD on IResolver when requested on GetAddrInfoRequest* and GetHostByNameRequest*.
2022-01-03misc: Improve DNS blacklist for Nintendo servers (#2963)Mary
This blocks more that have been seen in the wild
2021-12-29Improve SocketOption handling (#2946)gdkchan
2021-12-28Fix GetHostByNameRequestWithOptions and GetHostByAddrRequestWithOptions (#2943)gdkchan
2021-12-26Fix GetAddrInfoWithOptions and some sockets issues (#2936)gdkchan
* Fix GetAddrInfoWithOptions and some sockets issues * Was not supposed to remove this log
2021-10-24hle: Improve safety (#2778)Mary
* timezone: Make timezone implementation safe * hle: Do not use TrimEnd to parse ASCII strings This adds an util that handle reading an ASCII string in a safe way. Previously it was possible to read malformed data that could cause various undefined behaviours in multiple services. * hid: Remove an useless unsafe modifier on keyboard update * Address gdkchan's comment * Address gdkchan's comment
2021-09-15hos: Cleanup the project (#2634)Ac_K
* hos: Cleanup the project Since a lot of changes has been done on the HOS project, there are some leftover here and there, or class just used in one service, things at wrong places, and more. This PR fixes that, additionnally to that, I've realigned some vars because I though it make the code more readable. * Address gdkchan feedback * addresses Thog feedback * Revert ElfSymbol
2021-08-11hle: Tidy-up ServiceNotImplementedException (#2535)jduncanator
* hle: Simplify ServiceNotImplementedException This removes the need to pass in whether the command is a Tipc command or a Hipc command to the exception constructor. * hle: Use the IPC Message type to determine command type This allows differentiating between Tipc and Hipc commands when invoking a handler that supports handling both Tipc and Hipc commands.
2021-05-05nsd: Cleanup the service and implement some calls (#2250)Ac_K
* nim: Cleanup the service and implement some calls * Fix symbol typo * add ApplicationServerEnvironmentType enum * Change condition
2021-04-24HLE: Fix integer sign inconcistency accross the codebase (#2222)Mary
* Make all title id instances unsigned * Replace address and size with ulong instead of signed types Long overdue change. Also change some logics here and there to optimize with the new memory manager. * Address Ac_K's comments * Remove uneeded cast all around * Fixes some others misalignment
2021-04-14nsd/ssl: Fix Resolve/ResolveEx and stub GetConnectionCount (#2208)Ac_K
2021-04-14Initial support for the new 12.x IPC system (#2182)Mary
* Rename CommandAttribute as CommandHIpcAttribute to prepare for 12.x changes * Implement inital support for TIPC and adds SM command ids * *Ipc to *ipc * Missed a ref in last commit... * CommandAttributeTIpc to CommandAttributeTipc * Addresses comment and fixes some bugs around TIPC doesn't have any padding requirements as buffer C isn't a thing Fix for RegisterService inverting two argument only on TIPC
2021-04-13nifm/ssl: Implement GetCurrentNetworkProfile and stub Ssl Service (#2186)Ac_K
* nifm/ssl: Implement GetCurrentNetworkProfile and stub Ssl Service * remove InterfaceVersion
2021-03-30Patch up DNS Blacklist (#2153)mageven
Make the regex patterns case insensitive for robustness
2021-03-24sfdnsres: Cleanup service and implements some calls (#2130)Ac_K
* sfdnsres: Cleanup service and implements some calls This PR is a big cleanup to our current implementation of `sfdnsres` service. Additionnaly to that, some calls and fix have been done by @Thog (PRd with approval, thanks to her). - Implementation of `GetAddrInfoRequest` (Fixes #637). - Partial implementation of `GetHostByNameRequestWithOptions`, `GetHostByAddrRequestWithOptions` and `GetAddrInfoRequestWithOptions` (Fixes #642, Fixes #1233). A DNS Blacklist have been done by @riperiperi (which is currently used in LDN build, then that reduces code differences between the LDN build and master. Now a lot of games are playable or are blocked to the menu because it needs online service: Co-Authored-By: Mary <1760003+Thog@users.noreply.github.com> Co-Authored-By: riperiperi <6294155+riperiperi@users.noreply.github.com> * Addressed gdkchan's comments * IPAddress[] to IEnumerable * Nits Co-authored-by: Mary <1760003+Thog@users.noreply.github.com> Co-authored-by: riperiperi <6294155+riperiperi@users.noreply.github.com>
2020-12-02Create a single guest process per IPC message processor (#1769)gdkchan
2020-12-02IPC refactor part 2: Use ReplyAndReceive on HLE services and remove special ↵gdkchan
handling from kernel (#1458) * IPC refactor part 2: Use ReplyAndReceive on HLE services and remove special handling from kernel * Fix for applet transfer memory + some nits * Keep handles if possible to avoid server handle table exhaustion * Fix IPC ZeroFill bug * am: Correctly implement CreateManagedDisplayLayer and implement CreateManagedDisplaySeparableLayer CreateManagedDisplaySeparableLayer is requires since 10.x+ when appletResourceUserId != 0 * Make it exit properly * Make ServiceNotImplementedException show the full message again * Allow yielding execution to avoid starving other threads * Only wait if active * Merge IVirtualMemoryManager and IAddressSpaceManager * Fix Ro loading data from the wrong process Co-authored-by: Thog <me@thog.eu>
2020-09-22IPC refactor part 1: Use explicit separate threads to process requests (#1447)gdkchan
* Changes to allow explicit management of service threads * Remove now unused code * Remove ThreadCounter, its no longer needed * Allow and use separate server per service, also fix exit issues * New policy change: PTC version now uses PR number
2020-08-04Improved Logger (#1292)mageven
* Logger class changes only Now compile-time checking is possible with the help of Nullable Value types. * Misc formatting * Manual optimizations PrintGuestLog PrintGuestStackTrace Surfaceflinger DequeueBuffer * Reduce SendVibrationXX log level to Debug * Add Notice log level This level is always enabled and used to print system info, etc... Also, rewrite LogColor to switch expression as colors are static * Unify unhandled exception event handlers * Print enabled LogLevels during init * Re-add App Exit disposes in proper order nit: switch case spacing * Revert PrintGuestStackTrace to Info logs due to #1407 PrintGuestStackTrace is now called in some critical error handlers so revert to old behavior as KThread isn't part of Guest. * Batch replace Logger statements
2020-07-04Fix compilation warnings and use new LibHac APIs for executable loading (#1350)Mary
* Fix compilation warnings and use new LibHac APIs for executable loading * Migrate NSO loader to the new reader and fix kip loader * Fix CS0162 restore * Remove extra return lines * Address Moose's comment