LookupServer: Unbreak reverse DNS lookups

We were ignoring everything but A records in DNS responses. This broke
reverse lookups which obviously want the PTR records.

Fix this by filtering on the requested record type instead of always A.
This commit is contained in:
Andreas Kling 2021-01-30 12:06:51 +01:00
commit 1c6f278677
Notes: sideshowbarker 2024-07-18 22:44:12 +09:00

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -263,7 +263,7 @@ Vector<String> LookupServer::lookup(const String& hostname, const String& namese
Vector<String, 8> responses;
Vector<DNSAnswer, 8> cacheable_answers;
for (auto& answer : response.answers()) {
if (answer.type() != T_A)
if (answer.type() != record_type)
continue;
responses.append(answer.record_data());
if (!answer.has_expired())