diff options
author | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-11-17 20:36:05 +0100 |
---|---|---|
committer | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-11-17 20:36:05 +0100 |
commit | e6fc5e62dfad86a538c249f897ac2f40d8de5691 (patch) | |
tree | 354cc15f9a16c75d3bd9db196d558ed8e72f6482 | |
parent | d3d595c3f7219a75070cdea18f54a360c0222380 (diff) |
handle ipv6 link loss correctly
-rw-r--r-- | src/main.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index f70dc7c..b80f70f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,7 @@ use std::fs::File; use std::io; use std::net::{Ipv6Addr, SocketAddr}; +use std::path::Path; use std::thread; use std::time::Duration; @@ -54,6 +55,11 @@ fn main() -> Result<()> { fn logic(tnl: &mut Option<IpIp6>) -> Result<()> { *tnl = None; // Delete old tunnel. + if !Path::new(rsdsl_pd_config::LOCATION).exists() { + println!("[info] ipv6 down"); + return Ok(()); + } + let mut file = File::open(rsdsl_pd_config::LOCATION)?; let pdconfig: PdConfig = serde_json::from_reader(&mut file)?; |