diff options
author | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-11-18 12:46:56 +0100 |
---|---|---|
committer | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-11-18 12:46:56 +0100 |
commit | a05bf46ba9d4c5ca79fff5b83809315a82512e83 (patch) | |
tree | c8448caa6758485e685b47e63d10ec21a91f1773 | |
parent | 4834c3249e33bfbf259137d62f48fb7abce58532 (diff) |
update netlinklib
-rw-r--r-- | Cargo.lock | 5 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/main.rs | 12 |
3 files changed, 12 insertions, 7 deletions
@@ -441,12 +441,13 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "rsdsl_netlinklib" -version = "0.3.0" -source = "git+https://github.com/rsdsl/netlinklib.git#2c20dc2932696cb87ea7e6eb5327b7dccf0e9b1b" +version = "0.4.2" +source = "git+https://github.com/rsdsl/netlinklib.git#1954c7c7e975104fa651ccded4358826e8b3c8d8" dependencies = [ "futures", "libc", "netlink-packet-route", + "netlink-proto", "rtnetlink", "thiserror", "tokio", @@ -5,7 +5,7 @@ edition = "2021" [dependencies] pnet_packet = "0.33.0" -rsdsl_netlinklib = { git = "https://github.com/rsdsl/netlinklib.git", version = "0.3.0", features = ["addr", "blocking", "status"], default-features = false } +rsdsl_netlinklib = { git = "https://github.com/rsdsl/netlinklib.git", version = "0.4.2", features = ["addr", "blocking", "status"], default-features = false } signal-hook = "0.3.17" socket2 = { version = "0.5.2", features = ["all"] } thiserror = "1.0" diff --git a/src/main.rs b/src/main.rs index e4c0324..f92a23a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,7 +6,7 @@ use std::time::Duration; use pnet_packet::icmpv6::ndp::{MutableRouterAdvertPacket, NdpOption, NdpOptionType, RouterAdvert}; use pnet_packet::icmpv6::{Icmpv6Code, Icmpv6Type}; -use rsdsl_netlinklib::blocking::{addr, link}; +use rsdsl_netlinklib::blocking::Connection; use signal_hook::{consts::SIGUSR1, iterator::Signals}; use socket2::{Domain, Protocol, SockAddr, Socket, Type}; use thiserror::Error; @@ -48,13 +48,15 @@ fn run_supervised(link: String) -> ! { } fn run(link: String) -> Result<()> { + let conn = Connection::new()?; + println!("[info] wait for {}", link); - link::wait_up(link.clone())?; + conn.link_wait_up(link.clone())?; thread::sleep(Duration::from_secs(1)); println!("init {}", link); - let ifi = link::index(link.clone())?; + let ifi = conn.link_index(link.clone())?; let sock = Socket::new(Domain::IPV6, Type::RAW, Some(Protocol::ICMPV6))?; @@ -117,6 +119,8 @@ fn run(link: String) -> Result<()> { } fn create_ra_pkt(link: String) -> Result<(Vec<u8>, Vec<Ipv6Addr>)> { + let conn = Connection::new()?; + let mut rdnss_data = [ 0, 0, // Reserved 0, 0, 0x07, 0x08, // Lifetime: 1800s @@ -131,7 +135,7 @@ fn create_ra_pkt(link: String) -> Result<(Vec<u8>, Vec<Ipv6Addr>)> { }]; let mut prefixes = Vec::new(); - let ipv6_addrs = addr::get(link)?.into_iter().filter_map(|addr| { + let ipv6_addrs = conn.address_get(link)?.into_iter().filter_map(|addr| { if let IpAddr::V6(v6) = addr { Some(v6) } else { |