sys_net: SYS_NET_ENETDOWN for offline dns rqsts (#11822)

This commit is contained in:
RipleyTom 2022-04-16 14:00:04 +02:00 committed by GitHub
parent 6783bcd273
commit 895af3c3ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -869,11 +869,11 @@ std::optional<s32> lv2_socket_native::sendto(s32 flags, const std::vector<u8>& b
{
const s32 ret_analyzer = dnshook.analyze_dns_packet(lv2_id, reinterpret_cast<const u8*>(buf.data()), buf.size());
// If we're not connected just never send the packet and pretend we did
// If we're offline return ENETDOWN for dns requests
auto& nph = g_fxo->get<named_thread<np::np_handler>>();
if (!nph.get_net_status())
{
return {::narrow<s32>(buf.size())};
return -SYS_NET_ENETDOWN;
}
// Check if the packet is intercepted