From a569381037f4569d288486a48153ef08da1c9473 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Fri, 7 May 2021 15:03:52 +0200 Subject: [PATCH] LookupServer: Handle DNS record types TXT, AAAA, SRV and CNAME They're not being used elsewhere at the moment but this gets rid of the debug message for incoming mDNS response packets. --- Userland/Services/LookupServer/DNSAnswer.cpp | 9 +++++++++ Userland/Services/LookupServer/DNSAnswer.h | 3 +++ Userland/Services/LookupServer/DNSPacket.cpp | 8 ++++++++ 3 files changed, 20 insertions(+) diff --git a/Userland/Services/LookupServer/DNSAnswer.cpp b/Userland/Services/LookupServer/DNSAnswer.cpp index edb7e8234d..ed1c3bb126 100644 --- a/Userland/Services/LookupServer/DNSAnswer.cpp +++ b/Userland/Services/LookupServer/DNSAnswer.cpp @@ -52,6 +52,15 @@ void AK::Formatter::format(AK::FormatBuilder& build case LookupServer::DNSRecordType::MX: builder.put_string("MX"); return; + case LookupServer::DNSRecordType::TXT: + builder.put_string("TXT"); + return; + case LookupServer::DNSRecordType::AAAA: + builder.put_string("AAAA"); + return; + case LookupServer::DNSRecordType::SRV: + builder.put_string("SRV"); + return; } builder.put_string("DNS record type "); diff --git a/Userland/Services/LookupServer/DNSAnswer.h b/Userland/Services/LookupServer/DNSAnswer.h index a015a050d8..981f589ba7 100644 --- a/Userland/Services/LookupServer/DNSAnswer.h +++ b/Userland/Services/LookupServer/DNSAnswer.h @@ -20,6 +20,9 @@ enum class DNSRecordType : u16 { SOA = 6, PTR = 12, MX = 15, + TXT = 16, + AAAA = 28, + SRV = 33, }; enum class DNSRecordClass : u16 { diff --git a/Userland/Services/LookupServer/DNSPacket.cpp b/Userland/Services/LookupServer/DNSPacket.cpp index f76bbf9772..f7f67f0dcb 100644 --- a/Userland/Services/LookupServer/DNSPacket.cpp +++ b/Userland/Services/LookupServer/DNSPacket.cpp @@ -152,7 +152,15 @@ Optional DNSPacket::from_raw_packet(const u8* raw_data, size_t raw_si data = DNSName::parse(raw_data, dummy_offset, raw_size).as_string(); break; } + case DNSRecordType::CNAME: + // Fall through case DNSRecordType::A: + // Fall through + case DNSRecordType::TXT: + // Fall through + case DNSRecordType::AAAA: + // Fall through + case DNSRecordType::SRV: data = { record.data(), record.data_length() }; break; default: