From 3cc77acce60088f2d91394cb38fdcb25184845b9 Mon Sep 17 00:00:00 2001 From: Eric Long Date: Fri, 15 Nov 2024 22:47:35 +0800 Subject: [PATCH] nft: exit is terminate --- src/kernel/linux/nft.rs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/kernel/linux/nft.rs b/src/kernel/linux/nft.rs index cee817a..7143a17 100644 --- a/src/kernel/linux/nft.rs +++ b/src/kernel/linux/nft.rs @@ -54,17 +54,6 @@ impl Nftables { Ok(Self { table, chain }) } - async fn exit(&self) -> Result<()> { - let mut batch = Batch::new(); - batch.delete(schema::NfListObject::Chain(schema::Chain { - family: types::NfFamily::INet, - table: self.table.clone(), - name: self.chain.clone(), - ..Default::default() - })); - Ok(apply_ruleset_async(&batch.to_nftables(), None, None).await?) - } - pub fn make_new_rule( &self, stmts: Cow<'static, [stmt::Statement]>, @@ -100,7 +89,14 @@ impl Nftables { } pub async fn terminate(self) { - _ = self.exit().await; + let mut batch = Batch::new(); + batch.delete(schema::NfListObject::Chain(schema::Chain { + family: types::NfFamily::INet, + table: self.table.clone(), + name: self.chain.clone(), + ..Default::default() + })); + _ = apply_ruleset_async(&batch.to_nftables(), None, None).await; } }