aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/blocking.rs1
-rw-r--r--src/route.rs8
2 files changed, 9 insertions, 0 deletions
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,