warned = true;
}
-void bpf_firewall_close(Unit *u) {
- assert(u);
-
- CGroupRuntime *crt = unit_get_cgroup_runtime(u);
- if (!crt)
- return;
+void bpf_firewall_close(CGroupRuntime *crt) {
+ assert(crt);
crt->ip_accounting_ingress_map_fd = safe_close(crt->ip_accounting_ingress_map_fd);
crt->ip_accounting_egress_map_fd = safe_close(crt->ip_accounting_egress_map_fd);
#endif
fdset_free(crt->initial_restrict_ifaces_link_fds);
- safe_close(crt->ipv4_allow_map_fd);
- safe_close(crt->ipv6_allow_map_fd);
- safe_close(crt->ipv4_deny_map_fd);
- safe_close(crt->ipv6_deny_map_fd);
-
- bpf_program_free(crt->ip_bpf_ingress);
- bpf_program_free(crt->ip_bpf_ingress_installed);
- bpf_program_free(crt->ip_bpf_egress);
- bpf_program_free(crt->ip_bpf_egress_installed);
-
- set_free(crt->ip_bpf_custom_ingress);
- set_free(crt->ip_bpf_custom_ingress_installed);
- set_free(crt->ip_bpf_custom_egress);
- set_free(crt->ip_bpf_custom_egress_installed);
+ bpf_firewall_close(crt);
free(crt->cgroup_path);
if (u->in_release_resources_queue)
LIST_REMOVE(release_resources_queue, u->manager->release_resources_queue, u);
- bpf_firewall_close(u);
-
condition_free_list(u->conditions);
condition_free_list(u->asserts);