aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimbeerserverDE <himbeerserverde@gmail.com>2023-05-07 11:35:44 +0200
committerHimbeerserverDE <himbeerserverde@gmail.com>2023-05-07 11:35:44 +0200
commitd7a7f5bccc5511cf2727374b23deee68ca91d2c4 (patch)
treec3f1714a88d2f07280090838f66c0ec401114d79
parent7d0f4c9b6749e0edca5a2b41fd3ca90e2369d891 (diff)
configure fe80::1/64 on all lan interfaces
-rw-r--r--src/main.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index b070775..b7f41db 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,5 +1,5 @@
use std::ffi::c_void;
-use std::fs::File;
+use std::fs::{self, File};
use std::io::{self, Read};
use std::mem;
use std::net::{Ipv4Addr, Ipv6Addr};
@@ -63,6 +63,8 @@ impl From<Config> for UsableConfig {
}
}
+const LINK_LOCAL: Ipv6Addr = Ipv6Addr::new(0xfe80, 0, 0, 0, 0, 0, 0, 1);
+
fn send_to(ifi: i32, sock: &Socket, buf: &[u8]) -> io::Result<usize> {
let mut sa = libc::sockaddr_ll {
sll_family: (libc::AF_PACKET as u16).to_be(),
@@ -312,6 +314,7 @@ fn configure_eth0(config: &UsableConfig) -> Result<()> {
fs::write("/proc/sys/net/ipv6/conf/eth0/accept_ra", "0")?;
+ addr::add("eth0".into(), LINK_LOCAL.into(), 64)?;
addr::add("eth0".into(), addr_dbg.into(), 64)?;
addr::add("eth0".into(), addr.into(), 64)?;
@@ -343,6 +346,7 @@ fn configure_eth0_vlans(config: &UsableConfig) -> Result<()> {
fs::write("/proc/sys/net/ipv6/conf/{}/accept_ra", "0")?;
+ addr::add(vlan_name.clone(), LINK_LOCAL.into(), 64)?;
addr::add(vlan_name.clone(), vlan_addr.into(), 64)?;
println!(