aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml2
-rw-r--r--src/main.rs11
2 files changed, 12 insertions, 1 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 2e436f3..0275656 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,4 +6,4 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-rsdsl_netlinklib = { git = "https://github.com/rsdsl/netlinklib.git", version = "0.6.0", features = ["blocking", "rule"] }
+rsdsl_netlinklib = { git = "https://github.com/rsdsl/netlinklib.git", version = "0.6.0", features = ["blocking", "link", "rule"] }
diff --git a/src/main.rs b/src/main.rs
index 0754003..a6901c7 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -251,6 +251,13 @@ impl RouteDef {
Ok(())
}
+
+ fn link(&self) -> &str {
+ match self {
+ Self::V4(r) => &r.link,
+ Self::V6(r) => &r.link,
+ }
+ }
}
impl fmt::Display for RouteDef {
@@ -842,6 +849,10 @@ fn run() -> Result<(), Error> {
Err(e) => println!("[warn] del {}: {}", route, e),
}
+ println!("[info] wait for link {}", route.def.link());
+ conn.link_wait_exists(route.def.link().to_string())
+ .map_err(SetupError::from)?;
+
if !route.delete {
match route.def.clone().add(&conn) {
Ok(_) => println!("[info] add {}", route),