mirror of
https://github.com/GreemDev/Ryujinx
synced 2024-12-24 12:56:39 +01:00
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
This commit is contained in:
parent
79adba4402
commit
4864648e72
1 changed files with 27 additions and 0 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue