fix: nft populate community subnets on reload + generator_routes return fix for Telegram
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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"))
|
||||
|
||||
@@ -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 [];
|
||||
|
||||
Reference in New Issue
Block a user