diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-12-01 17:00:37 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-12-01 17:00:37 +0000 |
commit | 78ac4a61f7385eb05bafdbd465918be0b8c727d0 (patch) | |
tree | 92132781150f85561d30d49b24c4dae8fbb9d0a3 /contrib | |
parent | b805127041e641e3c5e4f8cd2eecc50f0df1f1ad (diff) | |
download | rspamd-78ac4a61f7385eb05bafdbd465918be0b8c727d0.tar.gz rspamd-78ac4a61f7385eb05bafdbd465918be0b8c727d0.zip |
[Minor] Process DNS reply flags
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/librdns/rdns.h | 7 | ||||
-rw-r--r-- | 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) { |