+void load_all_nodes(void) {
+ DIR *dir;
+ struct dirent *ent;
+ char dname[PATH_MAX];
+
+ snprintf(dname, sizeof(dname), "%s" SLASH "hosts", confbase);
+ dir = opendir(dname);
+
+ if(!dir) {
+ logger(DEBUG_ALWAYS, LOG_ERR, "Could not open %s: %s", dname, strerror(errno));
+ return;
+ }
+
+ while((ent = readdir(dir))) {
+ if(!check_id(ent->d_name)) {
+ continue;
+ }
+
+ node_t *n = lookup_node(ent->d_name);
+
+ splay_tree_t config;
+ init_configuration(&config);
+ read_config_options(&config, ent->d_name);
+ read_host_config(&config, ent->d_name, true);
+
+ if(!n) {
+ n = new_node();
+ n->name = xstrdup(ent->d_name);
+ node_add(n);
+ }
+
+ if(strictsubnets) {
+ for(config_t *cfg = lookup_config(&config, "Subnet"); cfg; cfg = lookup_config_next(&config, cfg)) {
+ subnet_t *s, *s2;
+
+ if(!get_config_subnet(cfg, &s)) {
+ continue;
+ }
+
+ if((s2 = lookup_subnet(n, s))) {
+ s2->expires = -1;
+ free(s);
+ } else {
+ subnet_add(n, s);
+ }
+ }
+ }
+
+ if(lookup_config(&config, "Address")) {
+ n->status.has_address = true;
+ }
+
+ splay_empty_tree(&config);
+ }
+
+ closedir(dir);
+}
+
+char *get_name(void) {
+ char *name = NULL;
+ char *returned_name;
+
+ get_config_string(lookup_config(&config_tree, "Name"), &name);
+
+ if(!name) {
+ return NULL;
+ }
+
+ returned_name = replace_name(name);
+ free(name);
+ return returned_name;
+}
+
+bool setup_myself_reloadable(void) {
+ free(scriptinterpreter);
+ scriptinterpreter = NULL;
+
+ get_config_string(lookup_config(&config_tree, "ScriptsInterpreter"), &scriptinterpreter);
+
+ free(scriptextension);
+
+ if(!get_config_string(lookup_config(&config_tree, "ScriptsExtension"), &scriptextension)) {
+ scriptextension = xstrdup("");
+ }
+
+ char *proxy = NULL;
+
+ get_config_string(lookup_config(&config_tree, "Proxy"), &proxy);
+
+ if(proxy) {
+ char *space;
+
+ if((space = strchr(proxy, ' '))) {
+ *space++ = 0;
+ }
+
+ if(!strcasecmp(proxy, "none")) {
+ proxytype = PROXY_NONE;
+ } else if(!strcasecmp(proxy, "socks4")) {
+ proxytype = PROXY_SOCKS4;
+ } else if(!strcasecmp(proxy, "socks4a")) {
+ proxytype = PROXY_SOCKS4A;
+ } else if(!strcasecmp(proxy, "socks5")) {
+ proxytype = PROXY_SOCKS5;
+ } else if(!strcasecmp(proxy, "http")) {
+ proxytype = PROXY_HTTP;
+ } else if(!strcasecmp(proxy, "exec")) {
+ proxytype = PROXY_EXEC;
+ } else {
+ logger(DEBUG_ALWAYS, LOG_ERR, "Unknown proxy type %s!", proxy);
+ free(proxy);
+ return false;
+ }
+
+ free(proxyhost);
+ proxyhost = NULL;
+
+ free(proxyport);
+ proxyport = NULL;
+
+ free(proxyuser);
+ proxyuser = NULL;
+
+ free(proxypass);
+ proxypass = NULL;
+
+ switch(proxytype) {
+ case PROXY_NONE:
+ default:
+ break;
+
+ case PROXY_EXEC:
+ if(!space || !*space) {
+ logger(DEBUG_ALWAYS, LOG_ERR, "Argument expected for proxy type exec!");
+ free(proxy);
+ return false;