diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-11-10 23:34:40 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2021-02-16 10:03:43 +0100 |
commit | 5c1790d1cec785951f16addb257bbf13d594e02b (patch) | |
tree | 3d40bd2c072f21a1a6631ce396f56b2925357720 /src/resolve/resolved-dns-transaction.h | |
parent | 43fc4baa26ccf3bc5ee65d4c6fa4890084632f2b (diff) | |
download | systemd-5c1790d1cec785951f16addb257bbf13d594e02b.tar.gz |
resolved: propagate source where an RR from back to client
This is extremely useful when debugging stuff: knowing whether a result
was cached, came from network, or was synthesized.
Diffstat (limited to 'src/resolve/resolved-dns-transaction.h')
-rw-r--r-- | src/resolve/resolved-dns-transaction.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/resolve/resolved-dns-transaction.h b/src/resolve/resolved-dns-transaction.h index 2c1894f9c2..b036adec2e 100644 --- a/src/resolve/resolved-dns-transaction.h +++ b/src/resolve/resolved-dns-transaction.h @@ -169,6 +169,27 @@ static inline DnsResourceKey *dns_transaction_key(DnsTransaction *t) { return t->bypass->question->keys[0]; } +static inline uint64_t dns_transaction_source_to_query_flags(DnsTransactionSource s) { + + switch (s) { + + case DNS_TRANSACTION_NETWORK: + return SD_RESOLVED_FROM_NETWORK; + + case DNS_TRANSACTION_CACHE: + return SD_RESOLVED_FROM_CACHE; + + case DNS_TRANSACTION_ZONE: + return SD_RESOLVED_FROM_ZONE; + + case DNS_TRANSACTION_TRUST_ANCHOR: + return SD_RESOLVED_FROM_TRUST_ANCHOR; + + default: + return 0; + } +} + const char* dns_transaction_state_to_string(DnsTransactionState p) _const_; DnsTransactionState dns_transaction_state_from_string(const char *s) _pure_; |