diff --git a/tachyon/files/usr/lib/components/updates.uc b/tachyon/files/usr/lib/components/updates.uc index f75fb443..611de181 100644 --- a/tachyon/files/usr/lib/components/updates.uc +++ b/tachyon/files/usr/lib/components/updates.uc @@ -2212,6 +2212,7 @@ function import_builtin_subnets_from_rule(section, settings) { write_file(cached_file, join("\n", combined_lines) + "\n"); ensure_dir("/etc/tachyon/rulesets"); write_file(persistent_file, join("\n", combined_lines) + "\n"); + system("/etc/init.d/tachyon reload"); } } diff --git a/tachyon/files/usr/lib/nft/apply.uc b/tachyon/files/usr/lib/nft/apply.uc index 9756b535..26ff5b3a 100644 --- a/tachyon/files/usr/lib/nft/apply.uc +++ b/tachyon/files/usr/lib/nft/apply.uc @@ -1705,6 +1705,24 @@ function nft_populate_runtime_set_for_section(section, deferred_sections, table, if (ports != "" && !section_has_destination_matchers(section) && !nft_add_set_elements(table, sets.ports, ports)) return false; + + // Load cached community subnet files into nftables (populated at list-update and persisted) + // Note: call nft_add_file_chunks_to_family_sets directly because ucode does not hoist + // function declarations, and nft_add_subnet_file_for_section is defined below this function. + for (let community in connections.community_lists(section)) { + let service = as_string(community); + let cached_paths = [ + "/tmp/sing-box/rulesets/community-subnets-" + service + ".lst", + "/etc/tachyon/rulesets/community-subnets-" + service + ".lst" + ]; + for (let path in cached_paths) { + let st = fs.stat(path); + if (st != null && int(st.size) > 0) { + nft_add_file_chunks_to_family_sets(path, table, sets.subnets, sets.subnets6, "ips", "", "5000"); + break; + } + } + } } for (let source_ip in list_option(section, "fully_routed_ips")) diff --git a/tachyon/files/usr/lib/singbox/generator_routes.uc b/tachyon/files/usr/lib/singbox/generator_routes.uc index d1fd67fd..f10123d7 100644 --- a/tachyon/files/usr/lib/singbox/generator_routes.uc +++ b/tachyon/files/usr/lib/singbox/generator_routes.uc @@ -1135,6 +1135,8 @@ function load_community_subnet_cidrs(community) { if (line != "" && substr(line, 0, 1) != "#") push(cidrs, line); } + if (length(cidrs) > 0) + return cidrs; } } return [];