Bsd: Add support for dns_mitm (#4102)
* 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>
This commit is contained in:
parent
5f32a8ed94
commit
df758eddd1
2 changed files with 122 additions and 3 deletions
|
@ -18,7 +18,10 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres
|
|||
[Service("sfdnsres")]
|
||||
class IResolver : IpcService
|
||||
{
|
||||
public IResolver(ServiceCtx context) { }
|
||||
public IResolver(ServiceCtx context)
|
||||
{
|
||||
DnsMitmResolver.Instance.ReloadEntries(context);
|
||||
}
|
||||
|
||||
[CommandHipc(0)]
|
||||
// SetDnsAddressesPrivateRequest(u32, buffer<unknown, 5, 0>)
|
||||
|
@ -259,6 +262,16 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres
|
|||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
// Atmosphère extension for dns_mitm
|
||||
[CommandHipc(65000)]
|
||||
// AtmosphereReloadHostsFile()
|
||||
public ResultCode AtmosphereReloadHostsFile(ServiceCtx context)
|
||||
{
|
||||
DnsMitmResolver.Instance.ReloadEntries(context);
|
||||
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
private static ResultCode GetHostByNameRequestImpl(
|
||||
ServiceCtx context,
|
||||
ulong inputBufferPosition,
|
||||
|
@ -321,7 +334,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres
|
|||
|
||||
try
|
||||
{
|
||||
hostEntry = Dns.GetHostEntry(targetHost);
|
||||
hostEntry = DnsMitmResolver.Instance.ResolveAddress(targetHost);
|
||||
}
|
||||
catch (SocketException exception)
|
||||
{
|
||||
|
@ -537,7 +550,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres
|
|||
|
||||
try
|
||||
{
|
||||
hostEntry = Dns.GetHostEntry(targetHost);
|
||||
hostEntry = DnsMitmResolver.Instance.ResolveAddress(targetHost);
|
||||
}
|
||||
catch (SocketException exception)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue