From e5ea4dc09c47175dd6fc0190ed6495f8f316cf05 Mon Sep 17 00:00:00 2001 From: LapshinAE0 Date: Thu, 14 May 2026 21:46:27 +0300 Subject: [PATCH 1/4] feat: added in dpdk on-of filltring setting --- worker/src/dpdk_filter/proc_packets.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/worker/src/dpdk_filter/proc_packets.c b/worker/src/dpdk_filter/proc_packets.c index ec6f892..3d94a13 100644 --- a/worker/src/dpdk_filter/proc_packets.c +++ b/worker/src/dpdk_filter/proc_packets.c @@ -36,11 +36,16 @@ bool check_is_exception(uint16_t *port) { void pakage_processing(struct net_port *port_in, struct net_port *port_out, struct net_port *port_exception, uint16_t queue_number, uint16_t nb_pkts, struct rte_mbuf **pkts, - struct BASE_POLICY *policy) { + struct BASE_POLICY *policy, + bool filtring_is_turned_off) { uint16_t nb_rx = rte_eth_rx_burst(port_in->port_id, queue_number, pkts, nb_pkts); + if (filtring_is_turned_off) { + package_sending_decision(true, pkts, port_out, queue_number); + } + for (int i = 0; i < nb_rx; i++) { struct info_of_pakage info_pac; From 2d1a578efbadfb2272ce7c19dbc6f78379d9461d Mon Sep 17 00:00:00 2001 From: LapshinAE0 Date: Thu, 21 May 2026 00:34:16 +0300 Subject: [PATCH 2/4] fix: fix flow --- worker/include/dpdk_filter/proc_packets.h | 3 ++- worker/src/dpdk_filter/main.c | 2 +- worker/src/dpdk_filter/proc_packets.c | 8 ++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/worker/include/dpdk_filter/proc_packets.h b/worker/include/dpdk_filter/proc_packets.h index 69acb07..6cafacc 100644 --- a/worker/include/dpdk_filter/proc_packets.h +++ b/worker/include/dpdk_filter/proc_packets.h @@ -20,6 +20,7 @@ bool check_is_exception(uint16_t *port); void pakage_processing(struct net_port *port_in, struct net_port *port_out, struct net_port *port_exception, uint16_t queue_number, uint16_t nb_pkts, struct rte_mbuf **pkts, - struct BASE_POLICY *policy); + struct BASE_POLICY *policy, + bool filtring_is_turned_off); #endif \ No newline at end of file diff --git a/worker/src/dpdk_filter/main.c b/worker/src/dpdk_filter/main.c index 4422e31..ea54728 100644 --- a/worker/src/dpdk_filter/main.c +++ b/worker/src/dpdk_filter/main.c @@ -111,7 +111,7 @@ int main(int argc, char **argv) { while (running) { forward_to_out(port_exception, port_in, queue_number); pakage_processing(port_in, port_out, port_exception, queue_number, nb_pkts, - pkts, &policy); + pkts, &policy, false); forward_to_out(port_out, port_in, queue_number); if (++timer_check_counter >= timer_check_interval) { diff --git a/worker/src/dpdk_filter/proc_packets.c b/worker/src/dpdk_filter/proc_packets.c index 3d94a13..494b557 100644 --- a/worker/src/dpdk_filter/proc_packets.c +++ b/worker/src/dpdk_filter/proc_packets.c @@ -1,6 +1,7 @@ #include "proc_packets.h" #include "domain_cache.h" #include "ip_cache.h" +#include extern bool worker_classify(const char *type, const char *target, struct requested_classification *out_req); @@ -42,8 +43,11 @@ void pakage_processing(struct net_port *port_in, struct net_port *port_out, uint16_t nb_rx = rte_eth_rx_burst(port_in->port_id, queue_number, pkts, nb_pkts); - if (filtring_is_turned_off) { - package_sending_decision(true, pkts, port_out, queue_number); + + if (atomic_load(&filtring_is_turned_off)) { + for (int i = 0; i < nb_rx; i++) { + package_sending_decision(true, pkts[i], port_out, queue_number); + } } for (int i = 0; i < nb_rx; i++) { From 92a12025b762d31bcde1d505a702c070cbe7e851 Mon Sep 17 00:00:00 2001 From: LapshinAE0 Date: Thu, 21 May 2026 00:34:56 +0300 Subject: [PATCH 3/4] fix: linter --- worker/include/dpdk_filter/proc_packets.h | 3 +-- worker/src/dpdk_filter/proc_packets.c | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/worker/include/dpdk_filter/proc_packets.h b/worker/include/dpdk_filter/proc_packets.h index 6cafacc..3d12e2a 100644 --- a/worker/include/dpdk_filter/proc_packets.h +++ b/worker/include/dpdk_filter/proc_packets.h @@ -20,7 +20,6 @@ bool check_is_exception(uint16_t *port); void pakage_processing(struct net_port *port_in, struct net_port *port_out, struct net_port *port_exception, uint16_t queue_number, uint16_t nb_pkts, struct rte_mbuf **pkts, - struct BASE_POLICY *policy, - bool filtring_is_turned_off); + struct BASE_POLICY *policy, bool filtring_is_turned_off); #endif \ No newline at end of file diff --git a/worker/src/dpdk_filter/proc_packets.c b/worker/src/dpdk_filter/proc_packets.c index 494b557..2acb09f 100644 --- a/worker/src/dpdk_filter/proc_packets.c +++ b/worker/src/dpdk_filter/proc_packets.c @@ -43,7 +43,6 @@ void pakage_processing(struct net_port *port_in, struct net_port *port_out, uint16_t nb_rx = rte_eth_rx_burst(port_in->port_id, queue_number, pkts, nb_pkts); - if (atomic_load(&filtring_is_turned_off)) { for (int i = 0; i < nb_rx; i++) { package_sending_decision(true, pkts[i], port_out, queue_number); From b1701362ba832be24d80e130b12f99b92ff1a388 Mon Sep 17 00:00:00 2001 From: LapshinAE0 Date: Thu, 21 May 2026 10:45:18 +0300 Subject: [PATCH 4/4] fix: fixed name bd and added return --- worker/src/dpdk_filter/ip_cache.c | 4 ++-- worker/src/dpdk_filter/proc_packets.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/worker/src/dpdk_filter/ip_cache.c b/worker/src/dpdk_filter/ip_cache.c index ae57335..57bf762 100644 --- a/worker/src/dpdk_filter/ip_cache.c +++ b/worker/src/dpdk_filter/ip_cache.c @@ -243,7 +243,7 @@ static int insert_ip_main_record(const char *ip_str, } static int delete_ip_categories(const char *ip_str) { - const char *sql = "DELETE FROM ip_categories_table WHERE ip_str = ?"; + const char *sql = "DELETE FROM categories_table WHERE ip_str = ?"; sqlite3_stmt *stmt = NULL; int ret = sqlite3_prepare_v2(ip_cache_table, sql, -1, &stmt, NULL); if (ret != SQLITE_OK) { @@ -260,7 +260,7 @@ static int delete_ip_categories(const char *ip_str) { static int insert_ip_categories(const char *ip_str, struct node_cache_ip *node) { - const char *sql = "INSERT INTO ip_categories_table (ip_str, " + const char *sql = "INSERT INTO categories_table (ip_str, " "certain_category) VALUES (?, ?)"; sqlite3_stmt *stmt = NULL; int ret = sqlite3_prepare_v2(ip_cache_table, sql, -1, &stmt, NULL); diff --git a/worker/src/dpdk_filter/proc_packets.c b/worker/src/dpdk_filter/proc_packets.c index 2acb09f..5dbcf6e 100644 --- a/worker/src/dpdk_filter/proc_packets.c +++ b/worker/src/dpdk_filter/proc_packets.c @@ -47,6 +47,7 @@ void pakage_processing(struct net_port *port_in, struct net_port *port_out, for (int i = 0; i < nb_rx; i++) { package_sending_decision(true, pkts[i], port_out, queue_number); } + return; } for (int i = 0; i < nb_rx; i++) {