]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
emit a /0 ECS response on non-variable answers when using use-incoming-ecs, for the...
authorbert hubert <bert.hubert@netherlabs.nl>
Fri, 5 Oct 2018 13:25:59 +0000 (15:25 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 10 Jan 2019 09:53:57 +0000 (10:53 +0100)
pdns/pdns_recursor.cc

index 19a28408f23ed5e27b7ed7d9118d98a100b9a680..67ea44375fb291920fb6fe9962eba01d5772ace3 100644 (file)
@@ -1486,6 +1486,17 @@ static void startDoResolve(void *p)
     }
   sendit:;
 
+    if(g_useIncomingECS && haveEDNS && !sr.wasVariable()) {
+      EDNSSubnetOpts eo;
+      eo.source = dc->d_ednssubnet.source;
+      ComboAddress sa;
+      memset(&sa, 0, sizeof(sa));
+      sa.sin4.sin_family = eo.source.getNetwork().sin4.sin_family;
+      eo.scope = Netmask(sa, 0);
+
+      returnedEdnsOptions.push_back(make_pair(EDNSOptionCode::ECS, makeEDNSSubnetOptsString(eo)));
+    }
+
     if (haveEDNS) {
       /* we try to add the EDNS OPT RR even for truncated answers,
          as rfc6891 states: