From cf21c0860012a33ef2171faa25b52183c3c4bfd8 Mon Sep 17 00:00:00 2001 From: Connection Refused Date: Tue, 19 Oct 2021 02:36:17 +0800 Subject: [PATCH] [Redirector] Add one feature --- Redirector/EventHandler.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Redirector/EventHandler.cpp b/Redirector/EventHandler.cpp index 00c39030..5eceba87 100644 --- a/Redirector/EventHandler.cpp +++ b/Redirector/EventHandler.cpp @@ -322,13 +322,23 @@ void udpCanSend(ENDPOINT_ID id) void udpSend(ENDPOINT_ID id, const unsigned char* target, const char* buffer, int length, PNF_UDP_OPTIONS options) { - if (filterDNS && DNSHandler::IsDNS((PSOCKADDR_IN6)target)) + if (DNSHandler::IsDNS((PSOCKADDR_IN6)target)) { - UP += length; - DNSHandler::CreateHandler(id, (PSOCKADDR_IN6)target, buffer, length, options); + if (!filterDNS) + { + nf_udpPostSend(id, target, buffer, length, options); - wcout << "[Redirector][EventHandler][udpSend][" << id << "] DNS to " << ConvertIP((PSOCKADDR)target) << endl; - return; + wcout << "[Redirector][EventHandler][udpSend][" << id << "] B DNS to " << ConvertIP((PSOCKADDR)target) << endl; + return; + } + else + { + UP += length; + DNSHandler::CreateHandler(id, (PSOCKADDR_IN6)target, buffer, length, options); + + wcout << "[Redirector][EventHandler][udpSend][" << id << "] H DNS to " << ConvertIP((PSOCKADDR)target) << endl; + return; + } } udpContextLock.lock();