giampaolo / psutil

Cross-platform lib for process and system monitoring in Python
BSD 3-Clause "New" or "Revised" License
10.22k stars 1.38k forks source link

[Windows] Missing NICS in psutil.net_if_addrs() when no IP protocol is set #2352

Open deajan opened 8 months ago

deajan commented 8 months ago

Summary

Description

I was playing with psutil.net_if_addrs() to list all the NICS on a server, but noticed that two NICS were missing. Upon investigation, it seems that when the NIC interface doesn't have IPv4 and IPv6 protocol enabled, psutil won't add them to the list of NICS. While this could look like a normal bahavior, it limits the ability of psutil to see bridged / virtual switch connected NICs that will have IP protocol disabled because of the bridging. All kind of hypervisor systems (VirtualBox, VMWare workstation, Hyper-V) and other bridged NICS will be impacted by this.

Best regards.