From 56fbb54eee5c28af317068c62b7fed384203caeb Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Wed, 21 Sep 2022 17:32:40 +0800 Subject: [PATCH] fix: overture with edns options --- src/applet/overture.c | 6 ++++++ src/cleardns.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/applet/overture.c b/src/applet/overture.c index f723cd8..2f5506e 100644 --- a/src/applet/overture.c +++ b/src/applet/overture.c @@ -97,12 +97,15 @@ char* overture_config(overture *info) { // generate json configure from overture cJSON *primary = cJSON_CreateObject(); cJSON *primary_dns = cJSON_CreateArray(); + cJSON *primary_edns = cJSON_CreateObject(); port_str = uint32_to_string(info->domestic_port); char *domestic_port = string_join("127.0.0.1:", port_str); cJSON_AddStringToObject(primary, "name", "Domestic"); cJSON_AddStringToObject(primary, "address", domestic_port); cJSON_AddStringToObject(primary, "protocol", "udp"); cJSON_AddNumberToObject(primary, "timeout", info->timeout); + cJSON_AddStringToObject(primary_edns, "policy", "disable"); + cJSON_AddItemToObject(primary, "ednsClientSubnet", primary_edns); cJSON_AddItemToArray(primary_dns, primary); cJSON_AddItemToObject(config, "primaryDNS", primary_dns); free(domestic_port); @@ -110,12 +113,15 @@ char* overture_config(overture *info) { // generate json configure from overture cJSON *alternative = cJSON_CreateObject(); cJSON *alternative_dns = cJSON_CreateArray(); + cJSON *alternative_edns = cJSON_CreateObject(); port_str = uint32_to_string(info->foreign_port); char *foreign_addr = string_join("127.0.0.1:", port_str); cJSON_AddStringToObject(alternative, "name", "Foreign"); cJSON_AddStringToObject(alternative, "address", foreign_addr); cJSON_AddStringToObject(alternative, "protocol", "udp"); cJSON_AddNumberToObject(alternative, "timeout", info->timeout); + cJSON_AddStringToObject(alternative_edns, "policy", "disable"); + cJSON_AddItemToObject(alternative, "ednsClientSubnet", alternative_edns); cJSON_AddItemToArray(alternative_dns, alternative); cJSON_AddItemToObject(config, "alternativeDNS", alternative_dns); free(foreign_addr); diff --git a/src/cleardns.c b/src/cleardns.c index 62e6e50..759ab4f 100644 --- a/src/cleardns.c +++ b/src/cleardns.c @@ -79,17 +79,23 @@ int main(int argc, char *argv[]) { // ClearDNS service // TODO: crontab of assets // process_list_append(assets_load(loader.assets)); + // TODO: free assets_config process_list_append(dnsproxy_load("Domestic", loader.domestic, "domestic.json")); process_list_append(dnsproxy_load("Foreign", loader.foreign, "foreign.json")); process_list_append(overture_load(loader.diverter, "overture.json")); + overture_free(loader.diverter); + dnsproxy_free(loader.domestic); + dnsproxy_free(loader.foreign); if (loader.filter != NULL) { process_list_append(adguard_load(loader.filter, ADGUARD_DIR)); + adguard_free(loader.filter); } for (char **script = loader.script; *script != NULL; ++script) { log_info("Run custom script -> `%s`", *script); run_command(*script); } + string_list_free(loader.script); process_list_run();