]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: split out helper that checks whether we shall reply with EDNS0 DO
authorLennart Poettering <lennart@poettering.net>
Fri, 5 Mar 2021 17:01:27 +0000 (18:01 +0100)
committerLennart Poettering <lennart@poettering.net>
Sat, 6 Mar 2021 13:04:21 +0000 (14:04 +0100)
Just some refactoring, no actual code changes.

src/resolve/resolved-dns-stub.c

index c3a28d390a48a1e20add3e749aa0fa8dd222ef6d..b4df5837aad00d59947a1b402abdc90bf3d31590 100644 (file)
@@ -561,6 +561,19 @@ static int dns_stub_send(
         return 0;
 }
 
+static int dns_stub_reply_with_edns0_do(DnsQuery *q) {
+         assert(q);
+
+        /* Reply with DNSSEC DO set? Only if client supports it; and we did any DNSSEC verification
+         * ourselves, or consider the data fully authenticated because we generated it locally, or the client
+         * set cd */
+
+         return DNS_PACKET_DO(q->request_packet) &&
+                 (q->answer_dnssec_result >= 0 ||        /* we did proper DNSSEC validation … */
+                  dns_query_fully_authenticated(q) ||    /* … or we considered it authentic otherwise … */
+                  DNS_PACKET_CD(q->request_packet));     /* … or client set CD */
+}
+
 static int dns_stub_send_reply(
                 DnsQuery *q,
                 int rcode) {
@@ -571,14 +584,7 @@ static int dns_stub_send_reply(
 
         assert(q);
 
-        /* Reply with DNSSEC DO set? Only if client supports it; and we did any DNSSEC verification
-         * ourselves, or consider the data fully authenticated because we generated it locally, or
-         * the client set cd */
-        edns0_do =
-                DNS_PACKET_DO(q->request_packet) &&
-                (q->answer_dnssec_result >= 0 ||        /* we did proper DNSSEC validation … */
-                 dns_query_fully_authenticated(q) ||    /* … or we considered it authentic otherwise … */
-                 DNS_PACKET_CD(q->request_packet));     /* … or client set CD */
+        edns0_do = dns_stub_reply_with_edns0_do(q); /* let's check if we shall reply with EDNS0 DO? */
 
         r = dns_stub_assign_sections(
                         q,