From e6c6e63d23eb43c95ad93a92693ae2352c1299d3 Mon Sep 17 00:00:00 2001 From: sushen339 Date: Tue, 18 Nov 2025 13:30:35 +0800 Subject: [PATCH] modified: blockip/src/install.c --- blockip/src/install.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/blockip/src/install.c b/blockip/src/install.c index 273bfc5..b1583a7 100644 --- a/blockip/src/install.c +++ b/blockip/src/install.c @@ -152,7 +152,15 @@ int install_service(void) { /* 安装nftables */ check_and_install_nftables(); - + + /* 清空bip相关nft表和集合,防止历史残留 */ + char nft_clear_cmd[MAX_COMMAND_LEN]; + snprintf(nft_clear_cmd, sizeof(nft_clear_cmd), + "nft flush table '%s'; " + "nft delete table '%s' 2>/dev/null;", + NFT_TABLE, NFT_TABLE); + system(nft_clear_cmd); + /* 初始化规则 */ init_nftables_rules();