diff --git a/include/forti_api/dns_filter.hpp b/include/forti_api/dns_filter.hpp index 9eef49b..cab6e45 100644 --- a/include/forti_api/dns_filter.hpp +++ b/include/forti_api/dns_filter.hpp @@ -48,7 +48,16 @@ struct DNSFilterOptions { void allow(unsigned int category) { const auto& [match_found, index] = binary_search(category); - if (match_found) filters[index].action = "allow"; + if (match_found) { + std::vector new_filters(filters.size() - 1); + if (index == filters.size() - 1) filters.resize(filters.size() - 1); + else if (index == 0) std::move(filters.begin() + 1, filters.end(), new_filters.begin()); + else { + std::move(filters.begin(), filters.begin() + index, new_filters.begin()); + std::move(filters.begin() + index + 1, filters.end(), new_filters.begin() + index); + } + filters = new_filters; + } } void monitor(unsigned int category) {