Update unix.rs

main
shellrow 3 years ago
parent 1569bb2dd0
commit 9ee14ada71
  1. 4
      src/interface/unix.rs

@ -55,7 +55,7 @@ pub fn interfaces() -> Vec<Interface> {
for iface in &mut interfaces { for iface in &mut interfaces {
match local_ip { match local_ip {
IpAddr::V4(local_ipv4) => { IpAddr::V4(local_ipv4) => {
if iface.ipv4.contains(&local_ipv4) { if iface.ipv4.iter().any(|x| x.addr == local_ipv4) {
match gateway::linux::get_default_gateway(iface.name.clone()) { match gateway::linux::get_default_gateway(iface.name.clone()) {
Ok(gateway) => { Ok(gateway) => {
iface.gateway = Some(gateway); iface.gateway = Some(gateway);
@ -65,7 +65,7 @@ pub fn interfaces() -> Vec<Interface> {
} }
}, },
IpAddr::V6(local_ipv6) => { IpAddr::V6(local_ipv6) => {
if iface.ipv6.contains(&local_ipv6) { if iface.ipv6.iter().any(|x| x.addr == local_ipv6) {
match gateway::linux::get_default_gateway(iface.name.clone()) { match gateway::linux::get_default_gateway(iface.name.clone()) {
Ok(gateway) => { Ok(gateway) => {
iface.gateway = Some(gateway); iface.gateway = Some(gateway);

Loading…
Cancel
Save