diff options
author | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-11-13 12:29:01 +0100 |
---|---|---|
committer | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-11-13 12:32:55 +0100 |
commit | 8b19a1f824d8d9ae423406e269fb75a98849ad44 (patch) | |
tree | b36ce86c91406bc16684701a093ca638784a1f9d | |
parent | ed35bb384a77ba78baa6898df45ef4e7150a9df2 (diff) |
inform dhcp6 of ppp (de)configuration0.7.2
-rw-r--r-- | Cargo.lock | 2 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/main.rs | 23 |
3 files changed, 22 insertions, 5 deletions
@@ -462,7 +462,7 @@ dependencies = [ [[package]] name = "rsdsl_netlinkd" -version = "0.7.1" +version = "0.7.2" dependencies = [ "bitfield", "futures", @@ -1,6 +1,6 @@ [package] name = "rsdsl_netlinkd" -version = "0.7.1" +version = "0.7.2" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/main.rs b/src/main.rs index 65c463b..f09685f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -127,6 +127,10 @@ fn configure_wan() -> Result<()> { println!("[info] config ppp0 ll {}/64", v6.laddr); + // Forward the event to dhcp6. + // The IPv6 link has already been (re)configured at this point. + inform_dhcp6(); + if let Some(pd_config) = read_pd_config_optional() { let prefix = Ipv6Net::new(pd_config.prefix, pd_config.len)?.trunc(); let mut subnets = prefix.subnets(64)?; @@ -160,9 +164,7 @@ fn configure_wan() -> Result<()> { ); } - for radvd in System::new_all().processes_by_exact_name("rsdsl_radvd") { - radvd.kill_with(Signal::User1); - } + inform_radvd(); if link::exists("dslite0".to_string())? { link::up("dslite0".to_string())?; @@ -181,6 +183,9 @@ fn configure_wan() -> Result<()> { println!("[info] config dslite0 {}/29", ADDR_B4); } + } else { + // Deconfiguration is critical too, forward event to dhcp6. + inform_dhcp6(); } } } @@ -201,3 +206,15 @@ fn read_pd_config_optional() -> Option<PdConfig> { fn next_ifid1<T: Iterator<Item = Ipv6Net>>(subnets: &mut T) -> Result<Ipv6Addr> { Ok((u128::from(subnets.next().ok_or(Error::NotEnoughIpv6Subnets)?.addr()) + 1).into()) } + +fn inform_radvd() { + for radvd in System::new_all().processes_by_exact_name("rsdsl_radvd") { + radvd.kill_with(Signal::User1); + } +} + +fn inform_dhcp6() { + for dhcp6 in System::new_all().processes_by_exact_name("rsdsl_dhcp6") { + dhcp6.kill_with(Signal::User1); + } +} |