});
g_lua.writeFunction("truncateTC", [](bool tc) { g_truncateTC=tc; });
+ g_lua.writeFunction("fixupCase", [](bool fu) { g_fixupCase=fu; });
g_lua.registerMember("name", &ServerPolicy::name);
g_lua.registerMember("policy", &ServerPolicy::policy);
}
}
+ if(g_fixupCase) {
+ string realname = qname.toDNSString();
+ memcpy(response+12, realname.c_str(), realname.length());
+ }
+
if (putNonBlockingMsgLen(ci.fd, responseLen, ds->tcpSendTimeout))
writen2WithTimeout(ci.fd, response, responseLen, ds->tcpSendTimeout);
int g_tcpSendTimeout{2};
bool g_truncateTC{1};
+bool g_fixupCase{0};
static void truncateTC(const char* packet, unsigned int* len)
try
{
else
--state->outstanding; // you'd think an attacker could game this, but we're using connected socket
+ if(g_fixupCase) {
+ string realname = ids->qname.toDNSString();
+ memcpy(packet+12, realname.c_str(), realname.length());
+ }
+
if(dh->tc && g_truncateTC) {
truncateTC(packet, (unsigned int*)&len);
}
-
uint16_t * flags = getFlagsFromDNSHeader(dh);
uint16_t origFlags = ids->origFlags;
/* clear the flags we are about to restore */
extern vector<ClientState*> g_frontends;
extern std::string g_key; // in theory needs locking
extern bool g_truncateTC;
+extern bool g_fixupCase;
extern int g_tcpRecvTimeout;
extern int g_tcpSendTimeout;
extern uint16_t g_maxOutstanding;