aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimbeerserverDE <himbeerserverde@gmail.com>2023-11-14 20:09:36 +0100
committerHimbeerserverDE <himbeerserverde@gmail.com>2023-11-14 20:09:36 +0100
commite0106ac16acde55575aa069edbb4c187e2ea4ccd (patch)
treeca612abc0c49813104c8324b80386c657c270aba
parent8c5fa422280ba51fca67086dbfdb5dd6a836f98c (diff)
add dual-stack route flushing back in0.1.1
-rw-r--r--Cargo.toml2
-rw-r--r--src/blocking.rs1
-rw-r--r--src/route.rs8
3 files changed, 10 insertions, 1 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 2e81902..314971f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rsdsl_netlinklib"
-version = "0.1.0"
+version = "0.1.1"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
diff --git a/src/blocking.rs b/src/blocking.rs
index 4c73837..0dc8263 100644
--- a/src/blocking.rs
+++ b/src/blocking.rs
@@ -66,6 +66,7 @@ pub mod route {
blockify!(flush4, route::flush4, link: String);
blockify!(flush6, route::flush6, link: String);
+ blockify!(flush, route::flush, link: String);
blockify!(add4, route::add4, dst: Ipv4Addr, prefix_len: u8, rtr: Option<Ipv4Addr>, link: String);
blockify!(add6, route::add6, dst: Ipv6Addr, prefix_len: u8, rtr: Option<Ipv6Addr>, link: String);
}
diff --git a/src/route.rs b/src/route.rs
index 00bbef8..765fd23 100644
--- a/src/route.rs
+++ b/src/route.rs
@@ -82,6 +82,14 @@ pub async fn flush6(link: String) -> Result<()> {
Ok(())
}
+/// Flushes all routes from an interface.
+pub async fn flush(link: String) -> Result<()> {
+ flush4(link.clone()).await?;
+ flush6(link).await?;
+
+ Ok(())
+}
+
/// Adds a simple IPv4 route with an optional gateway.
pub async fn add4(
dst: Ipv4Addr,