]> granicus.if.org Git - pdns/commitdiff
make webserver list suffixnodetree blocks as well
authorbert hubert <bert.hubert@netherlabs.nl>
Fri, 10 Jun 2016 17:56:03 +0000 (19:56 +0200)
committerbert hubert <bert.hubert@netherlabs.nl>
Fri, 10 Jun 2016 17:56:03 +0000 (19:56 +0200)
pdns/dnsdist-web.cc

index 7c051f8df494fd037cc1047f15465be98bd21d0e..199a40320de3e393f6b6b6860aa6cb2c32d54fb9 100644 (file)
@@ -185,6 +185,22 @@ static void connectionThread(int sock, ComboAddress remote, string password, str
             obj.insert({e->first.toString(), thing});
           }
         }
+
+        auto slow2 = g_dynblockSMT.getCopy();
+        slow2.visit([&now,&obj](const SuffixMatchTree<DynBlock>& node) {
+            if(now <node.d_value.until) {
+              string dom("empty");
+              if(!node.d_value.domain.empty())
+                dom = node.d_value.domain.toString();
+              Json::object thing{{"reason", node.d_value.reason}, {"seconds", (double)(node.d_value.until.tv_sec - now.tv_sec)},
+                                                            {"blocks", (double)node.d_value.blocks} };
+
+              obj.insert({dom, thing});
+          }
+        });
+
+
+
         Json my_json = obj;
         resp.body=my_json.dump();
         resp.headers["Content-Type"] = "application/json";