aboutsummaryrefslogtreecommitdiff
path: root/examples/add-rules.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/add-rules.rs')
-rw-r--r--examples/add-rules.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/examples/add-rules.rs b/examples/add-rules.rs
index 229db97..11e7b6f 100644
--- a/examples/add-rules.rs
+++ b/examples/add-rules.rs
@@ -37,7 +37,7 @@
//! ```
use ipnetwork::{IpNetwork, Ipv4Network};
-use rustables::{query::send_batch, Batch, ProtoFamily, Table};
+use rustables::{Batch, ProtoFamily, Table};
//use rustables::{nft_expr, query::send_batch, sys::libc, Batch, Chain, ProtoFamily, Rule, Table};
use std::{ffi::CString, io, net::Ipv4Addr, rc::Rc};
@@ -57,6 +57,10 @@ fn main() -> Result<(), Error> {
// this table under its `ProtoFamily::Inet` ruleset.
batch.add(&table, rustables::MsgType::Add);
+ let table = Table::new("lool", ProtoFamily::Inet);
+
+ batch.add(&table, rustables::MsgType::Add);
+
// // Create input and output chains under the table we created above.
// // Hook the chains to the input and output event hooks, with highest priority (priority zero).
// // See the `Chain::set_hook` documentation for details.
@@ -170,7 +174,7 @@ fn main() -> Result<(), Error> {
// Finalize the batch and send it. This means the batch end message is written into the batch, telling
// netfilter the we reached the end of the transaction message. It's also converted to a
// Vec<u8>, containing the raw netlink data so it can be sent over a netlink socket to netfilter.
- Ok(send_batch(batch)?)
+ Ok(batch.send()?)
}
// Look up the interface index for a given interface name.