+stats_results_callback(int resc, const char *resv[], int status, void *data)
+{
+ if(status == 0)
+ {
+ rb_dlink_node *n, *tn;
+
+ RB_DLINK_FOREACH_SAFE(n, tn, nameservers.head)
+ {
+ /* Clean up old nameservers */
+ rb_free(n->data);
+ rb_dlinkDestroy(n, &nameservers);
+ }
+
+ for(int i = 0; i < resc; i++)
+ rb_dlinkAddAlloc(rb_strdup(resv[i]), &nameservers);
+ }
+ else
+ {
+ const char *error = resc ? resv[resc] : "Unknown error";
+ iwarn("Error getting DNS servers: %s", error);
+ }
+}
+
+
+void
+init_dns(void)
+{
+ query_dict = rb_dictionary_create("dns queries", rb_uint32cmp);
+ stat_dict = rb_dictionary_create("dns stat queries", rb_uint32cmp);
+ (void)get_nameservers(stats_results_callback, NULL);
+}
+
+void
+reload_nameservers(void)
+{
+ check_authd();
+ rb_helper_write(authd_helper, "H D");
+ (void)get_nameservers(stats_results_callback, NULL);
+}
+
+
+static void
+submit_dns(uint32_t nid, char type, const char *addr)