feat: trying out smoltcp
This commit is contained in:
@@ -146,7 +146,7 @@ pub fn get_macs_and_src_for_ip(
|
||||
neighs: &Cache<Neigh>,
|
||||
links: &Cache<Link>,
|
||||
addr: Ipv4Addr,
|
||||
) -> Option<(String, Ipv4Addr, [u8; 6], [u8; 6])> {
|
||||
) -> Option<(String, i32, Ipv4Addr, [u8; 6], [u8; 6], u8)> {
|
||||
let mut sorted_routes = routes.iter().collect::<Vec<_>>();
|
||||
|
||||
sorted_routes.sort_by(|r1, r2| {
|
||||
@@ -182,6 +182,7 @@ pub fn get_macs_and_src_for_ip(
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
{
|
||||
println!("Link index: {link_ind}\n");
|
||||
for link in links.iter() {
|
||||
println!(
|
||||
"Link {}: {:?} ({})",
|
||||
@@ -202,7 +203,6 @@ pub fn get_macs_and_src_for_ip(
|
||||
.iter()
|
||||
.filter(|neigh| neigh.ifindex() == link.ifindex())
|
||||
{
|
||||
println!("\t\ttest {:?}, {:?}", neigh.ifindex(), neigh.dst());
|
||||
println!("\t\t{:?}, {:?}", neigh.dst(), neigh.lladdr());
|
||||
}
|
||||
}
|
||||
@@ -221,9 +221,11 @@ pub fn get_macs_and_src_for_ip(
|
||||
|
||||
Some((
|
||||
link.name(),
|
||||
link_ind,
|
||||
(&srcip.local()?).try_into().ok()?,
|
||||
link.addr().hw_address().try_into().ok()?,
|
||||
neigh,
|
||||
route.dst().unwrap().cidrlen() as u8,
|
||||
))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user