diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index 44aba44..1bae6f4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,9 +6,11 @@ use std::fs::File; use std::sync::mpsc; use std::sync::Arc; use std::thread; +use std::time::Duration; use byteorder::{ByteOrder, NetworkEndian as NE}; use pppoe::packet::IPV4; +use rsdsl_netlinkd::link; use tun_tap::{Iface, Mode}; fn prepend<T>(v: Vec<T>, s: &[T]) -> Vec<T> @@ -69,6 +71,11 @@ fn main() -> Result<()> { println!("read config, launching on interface {}", config.link); + while !link::is_up(config.link.clone())? { + println!("waiting for {} to come up", config.link); + thread::sleep(Duration::from_secs(8)); + } + let (tx, rx) = mpsc::channel(); let tun = Arc::new(Iface::new("rsppp0", Mode::Tun)?); let clt = Client::new(config)?; |