commit 78ac4a6: [Minor] Process DNS reply flags
Vsevolod Stakhov
vsevolod at highsecure.ru
Wed Dec 1 19:42:04 UTC 2021
Author: Vsevolod Stakhov
Date: 2021-12-01 17:00:37 +0000
URL: https://github.com/rspamd/rspamd/commit/78ac4a61f7385eb05bafdbd465918be0b8c727d0
[Minor] Process DNS reply flags
---
contrib/librdns/rdns.h | 7 ++++++-
contrib/librdns/resolver.c | 8 ++++++--
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/contrib/librdns/rdns.h b/contrib/librdns/rdns.h
index 4df1991fd..266ccabc2 100644
--- a/contrib/librdns/rdns.h
+++ b/contrib/librdns/rdns.h
@@ -129,13 +129,18 @@ enum dns_rcode {
RDNS_RC_NOREC = 13
};
+enum dns_reply_flags {
+ RDNS_AUTH = (1u << 0u),
+ RDNS_TRUNCATED = (1u << 1u)
+};
+
struct rdns_reply {
struct rdns_request *request;
struct rdns_resolver *resolver;
struct rdns_reply_entry *entries;
const char *requested_name;
enum dns_rcode code;
- bool authenticated;
+ uint8_t flags; /* see enum dns_reply_flags */
};
typedef void (*rdns_periodic_callback)(void *user_data);
diff --git a/contrib/librdns/resolver.c b/contrib/librdns/resolver.c
index 2c402077c..a0f09a294 100644
--- a/contrib/librdns/resolver.c
+++ b/contrib/librdns/resolver.c
@@ -149,7 +149,7 @@ rdns_make_reply (struct rdns_request *req, enum dns_rcode rcode)
rep->entries = NULL;
rep->code = rcode;
req->reply = rep;
- rep->authenticated = false;
+ rep->flags = 0;
rep->requested_name = req->requested_names[0].name;
}
@@ -223,7 +223,11 @@ rdns_parse_reply (uint8_t *in, int r, struct rdns_request *req,
rep = rdns_make_reply (req, header->rcode);
if (header->ad) {
- rep->authenticated = true;
+ rep->flags |= RDNS_AUTH;
+ }
+
+ if (header->tc) {
+ rep->flags |= RDNS_TRUNCATED;
}
if (rep == NULL) {
More information about the Commits
mailing list