Skip to content

Commit 431089b

Browse files
vsilentCopilot
andcommitted
fix: convert NfTable to string before passing to args()
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent a22ab6d commit 431089b

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/firewall/nftables.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@ impl NfTablesBackend {
9595

9696
/// Create a table
9797
pub fn create_table(&self, table: &NfTable) -> Result<()> {
98+
let table_str = table.to_string();
9899
let output = Command::new("nft")
99-
.args(["add", "table", &table])
100+
.args(["add", "table", &table_str])
100101
.output()
101102
.context("Failed to create nftables table")?;
102103

@@ -112,8 +113,9 @@ impl NfTablesBackend {
112113

113114
/// Delete a table
114115
pub fn delete_table(&self, table: &NfTable) -> Result<()> {
116+
let table_str = table.to_string();
115117
let output = Command::new("nft")
116-
.args(["delete", "table", &table])
118+
.args(["delete", "table", &table_str])
117119
.output()
118120
.context("Failed to delete nftables table")?;
119121

0 commit comments

Comments
 (0)