Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

atfer Unplug the network cable, I got the same response. #44

Open
zrz4066 opened this issue Sep 20, 2023 · 5 comments
Open

atfer Unplug the network cable, I got the same response. #44

zrz4066 opened this issue Sep 20, 2023 · 5 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed os-windows

Comments

@zrz4066
Copy link

zrz4066 commented Sep 20, 2023

network-interface can show the network interce .Actually atfer Unplug the network cable, I got the same response.

itf:NetworkInterface { name: "以太网", addr: [V6(V6IfAddr { ip: fe80::322c:fcc3:745d:86d8, broadcast: None, netmask: None })], mac_addr: Some("E8:6A:64:80:BF:F5"), index: 17 }
itf:NetworkInterface { name: "以太网", addr: [V4(V4IfAddr { ip: 192.168.3.201, broadcast: Some(192.168.3.255), netmask: Some(255.255.255.0) })], mac_addr: Some("E8:6A:64:80:BF:F5"), index: 17 }
itf:NetworkInterface { name: "以太网", addr: [V4(V4IfAddr { ip: 192.168.10.201, broadcast: Some(192.168.3.255), netmask: Some(255.255.255.0) })], mac_addr: Some("E8:6A:64:80:BF:F5"), index: 17 }
itf:NetworkInterface { name: "以太网", addr: [V4(V4IfAddr { ip: 192.168.100.201, broadcast: Some(192.168.3.255), netmask: Some(255.255.255.0) })], mac_addr: Some("E8:6A:64:80:BF:F5"), index: 17 }
itf:NetworkInterface { name: "以太网 2", addr: [V6(V6IfAddr { ip: fe80::1918:6d19:1c08:3d8f, broadcast: None, netmask: None })], mac_addr: Some("0A:00:27:00:00:05"), index: 5 }
itf:NetworkInterface { name: "以太网 2", addr: [V4(V4IfAddr { ip: 192.168.56.1, broadcast: Some(192.168.56.255), netmask: Some(255.255.255.0) })], mac_addr: Some("0A:00:27:00:00:05"), index: 5 }
itf:NetworkInterface { name: "本地连接* 1", addr: [V6(V6IfAddr { ip: fe80::ef61:935a:9cc6:223d, broadcast: None, netmask: None })], mac_addr: Some("FA:A2:D6:DE:6F:37"), index: 8 }
itf:NetworkInterface { name: "本地连接* 1", addr: [V4(V4IfAddr { ip: 169.254.30.206, broadcast: None, netmask: Some(255.255.0.0) })], mac_addr: Some("FA:A2:D6:DE:6F:37"), index: 8 }
itf:NetworkInterface { name: "本地连接* 10", addr: [V6(V6IfAddr { ip: fe80::3883:5d0b:7d77:3e81, broadcast: None, netmask: None })], mac_addr: Some("FE:A2:D6:DF:6F:37"), index: 12 }
itf:NetworkInterface { name: "本地连接* 10", addr: [V4(V4IfAddr { ip: 169.254.192.168, broadcast: None, netmask: Some(255.255.0.0) })], mac_addr: Some("FE:A2:D6:DF:6F:37"), index: 12 }
itf:NetworkInterface { name: "WLAN", addr: [V6(V6IfAddr { ip: fe80::b329:92f2:11e4:9258, broadcast: None, netmask: None })], mac_addr: Some("F8:A2:D6:B9:9A:55"), index: 3 }
itf:NetworkInterface { name: "WLAN", addr: [V4(V4IfAddr { ip: 192.168.2.4, broadcast: Some(192.168.2.255), netmask: Some(255.255.255.0) })], mac_addr: Some("F8:A2:D6:B9:9A:55"), index: 3 }
itf:NetworkInterface { name: "蓝牙网络连接", addr: [V6(V6IfAddr { ip: fe80::2dc5:cd8b:ccb:4b8f, broadcast: None, netmask: None })], mac_addr: Some("F8:A2:D6:B9:9A:56"), index: 18 }
itf:NetworkInterface { name: "蓝牙网络连接", addr: [V4(V4IfAddr { ip: 169.254.76.35, broadcast: None, netmask: Some(255.255.0.0) })], mac_addr: Some("F8:A2:D6:B9:9A:56"), index: 18 }
itf:NetworkInterface { name: "Loopback Pseudo-Interface 1", addr: [V6(V6IfAddr { ip: ::1, broadcast: None, netmask: None })], mac_addr: None, index: 1 }
itf:NetworkInterface { name: "Loopback Pseudo-Interface 1", addr: [V4(V4IfAddr { ip: 127.0.0.1, broadcast: Some(127.255.255.255), netmask: Some(255.0.0.0) })], mac_addr: None, index: 1 }

@EstebanBorai
Copy link
Owner

Hi @zrz4066, thanks for openning this issue!

Can you help me with more context? Could you please provide information such as OS, Version and how are you using the crate?

Its important to mention that theres no persisntance of data nor cache in the call to show.

Every invocation on show is idempotent, and will perform syscalls to pull data from the OS and parse it into crate structs.

@Llorx
Copy link

Llorx commented Nov 3, 2023

That also happens to me in Windows 11. Maybe if you add a "is_up()" method (like default-net does) that will return true or false if the interface is plugged or not, will solve the problem.

@EstebanBorai
Copy link
Owner

Hi @Llorx!

Thanks for sharing insights, PRs are welcome in case you want to provide a suggestion on a fix!

I will mark this a windows and help wanted as I lack of access to Windows System ATM.

@EstebanBorai EstebanBorai added bug Something isn't working help wanted Extra attention is needed os-windows labels Nov 6, 2023
@Llorx
Copy link

Llorx commented Nov 6, 2023

I would be glad, but the project where I use this crate is my first rust one, so I have a looooong way until I know how to do things properly. The borrow checker is a pain, being a noob xD

Maybe in a couple of weeks I can do so.

@EstebanBorai
Copy link
Owner

Hi @Llorx! No worries we are here to help! Feel free to mention me in this thread if you need any assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed os-windows
Projects
None yet
Development

No branches or pull requests

3 participants