Commit 6197d913 authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Only forward queries which have a type (crashes at dnsMessage.toArray() otherwise)

parent 67f73788
......@@ -48,8 +48,10 @@ class ProxyTlsHandler(
) {
val destination = selectAddressOrNull(realDestination)
if(destination != null) {
val data = dnsMessage.toArray()
sendPacketToUpstreamDNSServer(deviceWriteToken, DatagramPacket(data, 0, data.size, destination, realDestination.port), originalEnvelope)
if(dnsMessage.questions.all { it.type != null }) {
val data = dnsMessage.toArray()
sendPacketToUpstreamDNSServer(deviceWriteToken, DatagramPacket(data, 0, data.size, destination, realDestination.port), originalEnvelope)
}
} else {
val response = dnsMessage.asBuilder().setQrFlag(true).setResponseCode(DnsMessage.RESPONSE_CODE.SERVER_FAIL)
dnsPacketProxy?.tunnelHandle?.proxy?.logger?.warning("Cannot forward packet because the address isn't resolved yet.")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment