kr_request: move ::qsource.tcp to ::qsource.flags.tcp

parent a0cb9296
......@@ -163,6 +163,9 @@ struct kr_rplan {
knot_mm_t *pool;
uint32_t next_uid;
};
struct kr_request_qsource_flags {
_Bool tcp : 1;
};
struct kr_request {
struct kr_context *ctx;
knot_pkt_t *answer;
......@@ -171,7 +174,7 @@ struct kr_request {
const struct sockaddr *addr;
const struct sockaddr *dst_addr;
const knot_pkt_t *packet;
_Bool tcp;
struct kr_request_qsource_flags flags;
size_t size;
} qsource;
struct {
......
......@@ -74,6 +74,7 @@ genResType "knot_rrset_t" | sed 's/\<owner\>/_owner/; s/\<ttl\>/_ttl/'
struct kr_zonecut
kr_qarray_t
struct kr_rplan
struct kr_request_qsource_flags
struct kr_request
enum kr_rank
struct kr_cache
......
......@@ -321,12 +321,12 @@ static struct request_ctx *request_create(struct worker_ctx *worker,
if (uv_udp_getsockname((uv_udp_t *)handle, dst_addr, &addr_len) == 0) {
req->qsource.dst_addr = dst_addr;
}
req->qsource.tcp = false;
req->qsource.flags.tcp = false;
} else if (handle->type == UV_TCP) {
if (uv_tcp_getsockname((uv_tcp_t *)handle, dst_addr, &addr_len) == 0) {
req->qsource.dst_addr = dst_addr;
}
req->qsource.tcp = true;
req->qsource.flags.tcp = true;
}
return ctx;
......
......@@ -174,6 +174,12 @@ struct kr_context
knot_mm_t *pool;
};
/* Kept outside, because kres-gen.lua can't handle this depth
* (and lines here were too long anyway). */
struct kr_request_qsource_flags {
bool tcp:1; /**< true if the request is on tcp; only meaningful if (dst_addr). */
};
/**
* Name resolution request.
*
......@@ -194,7 +200,7 @@ struct kr_request {
/** Address that accepted the request. NULL for internal origin. */
const struct sockaddr *dst_addr;
const knot_pkt_t *packet;
bool tcp; /**< true if the request is on tcp; only meaningful if (dst_addr) */
struct kr_request_qsource_flags flags; /**< See definition above. */
size_t size; /**< query packet size */
} qsource;
struct {
......
......@@ -121,7 +121,7 @@ static int dnstap_log(kr_layer_t *ctx) {
}
if (req->qsource.dst_addr) {
if (req->qsource.tcp) {
if (req->qsource.flags.tcp) {
m.socket_protocol = DNSTAP__SOCKET_PROTOCOL__TCP;
} else {
m.socket_protocol = DNSTAP__SOCKET_PROTOCOL__UDP;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment