Skip to content
Snippets Groups Projects
Commit cd808b68 authored by Robert Edmonds's avatar Robert Edmonds Committed by Daniel Salzman
Browse files

kdig: record the dnstap SocketProtocol correctly when retrying over TCP

parent e9bdfb9e
No related branches found
No related tags found
No related merge requests found
......@@ -44,6 +44,7 @@ static int write_dnstap(dt_writer_t *writer,
Dnstap__Message msg;
Dnstap__Message__Type msg_type;
int ret;
int protocol = 0;
if (writer == NULL) {
return KNOT_EOK;
......@@ -54,8 +55,14 @@ static int write_dnstap(dt_writer_t *writer,
msg_type = is_response ? DNSTAP__MESSAGE__TYPE__TOOL_RESPONSE
: DNSTAP__MESSAGE__TYPE__TOOL_QUERY;
if (net->socktype == SOCK_DGRAM) {
protocol = IPPROTO_UDP;
} else if (net->socktype == SOCK_STREAM) {
protocol = IPPROTO_TCP;
}
ret = dt_message_fill(&msg, msg_type, net->local_info->ai_addr,
net->srv->ai_addr, net->srv->ai_protocol,
net->srv->ai_addr, protocol,
wire, wire_len, qtime, rtime);
if (ret != KNOT_EOK) {
return ret;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment