From 6a8f592346050dadb8321a3a70b43d32bddf4f23 Mon Sep 17 00:00:00 2001 From: Cooper Larson Date: Mon, 2 Sep 2024 09:42:55 -0600 Subject: [PATCH] rm filter to "allow" --- include/forti_api/dns_filter.hpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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) {