auto dc = std::make_unique<DNSComboWriter>(question, g_now, std::move(policyTags), t_pdl, std::move(data), std::move(records));
- if (SyncRes::isUnsupported(dc->d_mdp.d_qtype)) {
- g_stats.ignoredCount++;
- if (!g_quiet) {
- SLOG(g_log << Logger::Notice << RecThreadInfo::id() << " Unsupported qtype " << dc->d_mdp.d_qtype << " from " << source.toStringWithPort() << (source != fromaddr ? " (via " + fromaddr.toStringWithPort() + ")" : "") << endl,
- g_slogudpin->info(Logr::Notice, "Unsupported qtype", "qtype", Logging::Loggable(QType(dc->d_mdp.d_qtype)), "source", Logging::Loggable(source), "remote", Logging::Loggable(fromaddr)));
- }
-
- return 0;
- }
-
dc->setSocket(fd);
dc->d_tag = ctag;
dc->d_qhash = qhash;
#endif
};
+ const static uint16_t rfc6895MetaLowerBound = 128;
+ const static uint16_t rfc6895MetaUpperBound = 254; // Note 255: ANY is not included
+ const static uint16_t rfc6896Reserved = 65535;
+
const static map<const string, uint16_t> names;
const static map<uint16_t, const string> numbers;
}
return;
}
- if (SyncRes::isUnsupported(dc->d_mdp.d_qtype)) {
- g_stats.ignoredCount++;
- if (g_logCommonErrors) {
- SLOG(g_log << Logger::Error << "Unsupported qtype " << dc->d_mdp.d_qtype << " from TCP client " << conn->d_remote.toStringWithPort() << endl,
- g_slogtcpin->info(Logr::Error, "Unsupported qtype from TCP client", "remote", Logging::Loggable(conn->d_remote), "qtype", Logging::Loggable(dc->d_mdp.d_qtype)));
- }
- return;
- }
dc->d_tcpConnection = conn; // carry the torch
dc->setSocket(conn->getFD()); // this is the only time a copy is made of the actual fd
return 0; // so do check before updating counters (we do now)
}
- auto qtypeCode = qtype.getCode();
- /* rfc6895 section 3.1 */
- if (qtypeCode == 0 || (qtypeCode >= 128 && qtypeCode <= 254) || qtypeCode == QType::RRSIG || qtypeCode == QType::NSEC3 || qtypeCode == QType::OPT || qtypeCode == 65535) {
+ if (isUnsupported(qtype)) {
return -1;
}
static bool isUnsupported(QType qtype)
{
- switch (qtype.getCode()) {
+ auto qcode = qtype.getCode();
+ // rfc6895 section 3.1, note ANY is 255 and falls outside the range
+ if (qcode >= QType::rfc6895MetaLowerBound && qcode <= QType::rfc6895MetaUpperBound) {
+ return true;
+ }
+ switch (qcode) {
// Internal types
- case QType::ENT:
+ case QType::ENT: // aka TYPE0
case QType::ADDR:
+ // RFC
+ case QType::rfc6896Reserved:
+ // Other
+ case QType::RRSIG:
+ case QType::NSEC3: // what about NSEC?
+ case QType::OPT:
return true;
}
return false;