diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2022-01-08 20:18:09 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-08 20:18:09 -0300 |
| commit | 4864648e727c6f526e3b65478f222c15468f6074 (patch) | |
| tree | 9bdce278e83629a6d83c0e77b2a3f599e5a6e5b8 | |
| parent | 79adba44022abb5c1c547fb41d98a4d7a6b5029a (diff) | |
Return error on DNS resolution when guest internet access is disabled (#2983)
* Return error on DNS resolution when guest internet access is disabled
* Log DNS lookup calls
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs b/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs index 32346dc7..a07fc518 100644 --- a/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs +++ b/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs @@ -245,6 +245,15 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres { string host = MemoryHelper.ReadAsciiString(context.Memory, inputBufferPosition, (int)inputBufferSize); + if (!context.Device.Configuration.EnableInternetAccess) + { + Logger.Info?.Print(LogClass.ServiceSfdnsres, $"Guest network access disabled, DNS Blocked: {host}"); + + WriteResponse(context, withOptions, 0, GaiError.NoData, NetDbError.HostNotFound); + + return ResultCode.Success; + } + // TODO: Use params. bool enableNsdResolve = (context.RequestData.ReadInt32() & 1) != 0; int timeOut = context.RequestData.ReadInt32(); @@ -331,6 +340,15 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres ulong optionsBufferPosition, ulong optionsBufferSize) { + if (!context.Device.Configuration.EnableInternetAccess) + { + Logger.Info?.Print(LogClass.ServiceSfdnsres, $"Guest network access disabled, DNS Blocked."); + + WriteResponse(context, withOptions, 0, GaiError.NoData, NetDbError.HostNotFound); + + return ResultCode.Success; + } + byte[] rawIp = new byte[inputBufferSize]; context.Memory.Read(inputBufferPosition, rawIp); @@ -442,6 +460,15 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres string host = MemoryHelper.ReadAsciiString(context.Memory, context.Request.SendBuff[0].Position, (long)context.Request.SendBuff[0].Size); string service = MemoryHelper.ReadAsciiString(context.Memory, context.Request.SendBuff[1].Position, (long)context.Request.SendBuff[1].Size); + if (!context.Device.Configuration.EnableInternetAccess) + { + Logger.Info?.Print(LogClass.ServiceSfdnsres, $"Guest network access disabled, DNS Blocked: {host}"); + + WriteResponse(context, withOptions, 0, GaiError.NoData, NetDbError.HostNotFound); + + return ResultCode.Success; + } + // NOTE: We ignore hints for now. DeserializeAddrInfos(context.Memory, (ulong)context.Request.SendBuff[2].Position, (ulong)context.Request.SendBuff[2].Size); |
