diff options
-rw-r--r-- | Cargo.lock | 6 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/main.rs | 28 |
3 files changed, 12 insertions, 24 deletions
@@ -890,8 +890,8 @@ dependencies = [ [[package]] name = "rsdsl_netlinkd" -version = "0.6.1" -source = "git+https://github.com/rsdsl/netlinkd.git#bf65c247f58127fe151c8fd6d4e8d56218d27b7a" +version = "0.6.2" +source = "git+https://github.com/rsdsl/netlinkd.git#3f8ae378a6f7c1b1b4d4dbc8f9e3ffada6342721" dependencies = [ "futures", "futures-util", @@ -909,7 +909,7 @@ dependencies = [ [[package]] name = "rsdsl_netlinkd_sys" version = "0.4.9" -source = "git+https://github.com/rsdsl/netlinkd.git#bf65c247f58127fe151c8fd6d4e8d56218d27b7a" +source = "git+https://github.com/rsdsl/netlinkd.git#3f8ae378a6f7c1b1b4d4dbc8f9e3ffada6342721" dependencies = [ "bindgen", "cc", @@ -12,7 +12,7 @@ notify = "5.1.0" reqwest = { version = "0.11.17", default-features = false, features = ["blocking", "rustls-tls"] } rsdsl_he_config = { git = "https://github.com/rsdsl/he_config.git", version = "0.1.0" } rsdsl_ip_config = { git = "https://github.com/rsdsl/ip_config.git", version = "0.2.2" } -rsdsl_netlinkd = { git = "https://github.com/rsdsl/netlinkd.git", version = "0.6.1" } +rsdsl_netlinkd = { git = "https://github.com/rsdsl/netlinkd.git", version = "0.6.2" } rsdsl_netlinkd_sys = { git = "https://github.com/rsdsl/netlinkd.git", version = "0.4.9" } serde_json = "1.0" thiserror = "1.0" diff --git a/src/main.rs b/src/main.rs index 06587a3..73519d8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -35,8 +35,6 @@ enum Error { type Result<T> = std::result::Result<T, Error>; -const LINK_LOCAL: Ipv6Addr = Ipv6Addr::new(0xfe80, 0, 0, 0, 0, 0, 0, 1); - fn local_address() -> Result<Ipv4Addr> { let mut file = File::open(rsdsl_ip_config::LOCATION)?; let ds_config: DsConfig = serde_json::from_reader(&mut file)?; @@ -63,8 +61,8 @@ fn main() -> Result<()> { configure_endpoint(&config); configure_tunnel(&config, &dsconfig); - configure_lan(&config, &dsconfig); - configure_vlans(&config, &dsconfig); + configure_lan(&config); + configure_vlans(&config); fs::write("/proc/sys/net/ipv6/conf/all/forwarding", "1")?; @@ -152,14 +150,14 @@ fn configure_he6in4(config: &UsableConfig, dsconfig: &DsConfig) -> Result<()> { Ok(()) } -fn configure_lan(config: &UsableConfig, dsconfig: &DsConfig) { - match configure_eth0(config, dsconfig) { +fn configure_lan(config: &UsableConfig) { + match configure_eth0(config) { Ok(_) => {} Err(e) => println!("can't configure eth0: {:?}", e), } } -fn configure_eth0(config: &UsableConfig, dsconfig: &DsConfig) -> Result<()> { +fn configure_eth0(config: &UsableConfig) -> Result<()> { let addr_dbg: Ipv6Addr = (u128::from_be_bytes(config.rt64.trunc().addr().octets()) | 1).into(); let addr: Ipv6Addr = (u128::from_be_bytes(config.rt48.trunc().addr().octets()) | 1).into(); @@ -168,11 +166,6 @@ fn configure_eth0(config: &UsableConfig, dsconfig: &DsConfig) -> Result<()> { fs::write("/proc/sys/net/ipv6/conf/eth0/accept_ra", "0")?; - // Check for native connectivity to avoid breaking netlinkd. - if dsconfig.v6.is_none() { - addr::add_link_local("eth0".into(), LINK_LOCAL.into(), 64)?; - } - addr::add("eth0".into(), addr_dbg.into(), 64)?; addr::add("eth0".into(), addr.into(), 64)?; @@ -180,14 +173,14 @@ fn configure_eth0(config: &UsableConfig, dsconfig: &DsConfig) -> Result<()> { Ok(()) } -fn configure_vlans(config: &UsableConfig, dsconfig: &DsConfig) { - match configure_eth0_vlans(config, dsconfig) { +fn configure_vlans(config: &UsableConfig) { + match configure_eth0_vlans(config) { Ok(_) => {} Err(e) => println!("can't configure vlans: {:?}", e), } } -fn configure_eth0_vlans(config: &UsableConfig, dsconfig: &DsConfig) -> Result<()> { +fn configure_eth0_vlans(config: &UsableConfig) -> Result<()> { let zones = ["trusted", "untrusted", "isolated", "exposed"]; for (i, zone) in zones.iter().enumerate() { @@ -207,11 +200,6 @@ fn configure_eth0_vlans(config: &UsableConfig, dsconfig: &DsConfig) -> Result<() "0", )?; - // Check for native connectivity to avoid breaking netlinkd. - if dsconfig.v6.is_none() { - addr::add_link_local(vlan_name.clone(), LINK_LOCAL.into(), 64)?; - } - addr::add(vlan_name.clone(), vlan_addr.into(), 64)?; println!("configure {} ({}/64) zone {}", vlan_name, vlan_addr, zone); |