]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Process DNS reply flags
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 1 Dec 2021 17:00:37 +0000 (17:00 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 1 Dec 2021 17:00:37 +0000 (17:00 +0000)
contrib/librdns/rdns.h
contrib/librdns/resolver.c

index 4df1991fdff9ea12ab609147989602bcaa732958..266ccabc2d3cb7d408548f0a1fe1cba4a9a46d4a 100644 (file)
@@ -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);
index 2c402077c48f63c91c8f1b57ed7b0e468a66b57a..a0f09a294f05f0efbbc65fbdec6ef0ac909ea1ee 100644 (file)
@@ -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) {