Add IPv6 prefix handling to unix tun interface

This commit is contained in:
Conrad Kramer 2025-10-29 19:08:32 -07:00
parent 848efac15d
commit 3fb0269d7c
10 changed files with 229 additions and 41 deletions

View file

@ -46,7 +46,7 @@ fn test_set_get_ipv6() {
let tun = TunInterface::new()?;
let addr = Ipv6Addr::new(1, 1, 1, 1, 1, 1, 1, 1);
tun.set_ipv6_addr(addr)?;
tun.add_ipv6_addr(addr, 128)?;
// let result = tun.ipv6_addr()?;
// assert_eq!(addr, result);

View file

@ -1,5 +1,5 @@
use std::{io::Error, net::Ipv4Addr};
use std::net::Ipv6Addr;
use std::{io::Error, net::Ipv4Addr};
use fehler::throws;
use tun::TunInterface;
@ -44,5 +44,5 @@ fn set_ipv6() {
println!("tun name: {:?}", tun.name()?);
let targ_addr: Ipv6Addr = "::1".parse().unwrap();
println!("v6 addr: {:?}", targ_addr);
tun.set_ipv6_addr(targ_addr)?;
}
tun.add_ipv6_addr(targ_addr, 128)?;
}

View file

@ -1,3 +1,4 @@
#[cfg(all(feature = "tokio", not(target_os = "windows")))]
use std::net::Ipv4Addr;
#[tokio::test]