mod-dnstap: Restore the original query QNAME case
Previously, mod-dnstap would log query messages with downcased QNAMEs, because knotd had already downcased the QNAME in the query packet buffer passed to the dnstap module. This is not necessarily the same as the original DNS wire query message if any uppercase letters were used in the QNAME. The knotd_qdata_t object already stores the original QNAME before downcasing in the 'extra' field, which is inaccessible to query modules. This commit introduces a new 'knotd_qdata_orig_qname()' function that query modules can call to access the original QNAME. This commit updates the mod-dnstap message logging code to patch the buffer used for the wire message behind the 'query_message' field in the dnstap protobuf message by copying the original QNAME back into the query packet buffer, and then re-downcasing the QNAME in the query packet buffer after the dnstap protobuf message has been serialized. (This avoids the overhead of allocating space for a copy of the query packet, making a copy of the packet, and performing the QNAME restoration on the copy.) fixes #773
Please register or sign in to comment